/// <summary> /// Install plugin /// </summary> public override void Install() { var settings = new GoogleAnalyticsSettings { GoogleId = "UA-0000000-0", TrackingScript = @"<!-- Global site tag (gtag.js) - Google Analytics --> <script async src='https://www.googletagmanager.com/gtag/js?id={GOOGLEID}'></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '{GOOGLEID}'); {CUSTOMER_TRACKING} </script>", }; _settingService.SaveSetting(settings); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId", "ID"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId.Hint", "Enter Google Analytics ID."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.TrackingScript", "Tracking code"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.TrackingScript.Hint", "Paste the tracking code generated by Google Analytics here. {GOOGLEID} and {CUSTOMER_TRACKING} will be dynamically replaced."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EnableEcommerce", "Enable E-commerce"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EnableEcommerce.Hint", "Check to pass information about orders to Google E-commerce feature."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.IncludeCustomerId", "Include customer ID"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.IncludeCustomerId.Hint", "Check to include customer identifier to script."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.IncludingTax", "Include tax"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.IncludingTax.Hint", "Check to include tax when generating tracking code for {ECOMMERCE} part."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.Instructions", "<p>Google Analytics is a free website stats tool from Google. It keeps track of statistics about the visitors and eCommerce conversion on your website.<br /><br />Follow the next steps to enable Google Analytics integration:<br /><ul><li><a href=\"http://www.google.com/analytics/\" target=\"_blank\">Create a Google Analytics account</a> and follow the wizard to add your website</li><li>Copy the Tracking ID into the 'ID' box below</li><li>Click the 'Save' button below and Google Analytics will be integrated into your store</li></ul><br />If you would like to switch between Google Analytics (used by default) and Universal Analytics, then please use the buttons below:</p>"); base.Install(); }
/// <summary> /// Install plugin /// </summary> public override void Install() { var settings = new GoogleAnalyticsSettings() { GoogleId = "UA-0000000-0", //TrackingScript = "<script type=\"text/javascript\"> var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\"); document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\")); </script> <script type=\"text/javascript\"> try { var pageTracker = _gat._getTracker(\"UA-0000000-0\"); pageTracker._trackPageview(); } catch(err) {}</script>", TrackingScript = @"<!-- Google code for Analytics tracking --> <script type=""text/javascript""> var _gaq = _gaq || []; _gaq.push(['_setAccount', '{GOOGLEID}']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script>", /*EcommerceScript = @"_gaq.push(['_addTrans', '{ORDERID}', '{SITE}', '{TOTAL}', '{TAX}', '{SHIP}', '{CITY}', '{STATEPROVINCE}', '{COUNTRY}']); * {DETAILS} * _gaq.push(['_trackTrans']); ", * EcommerceDetailScript = @"_gaq.push(['_addItem', '{ORDERID}', '{PRODUCTSKU}', '{PRODUCTNAME}', '{CATEGORYNAME}', '{UNITPRICE}', '{QUANTITY}' ]); ", */ }; _settingService.SaveSetting(settings); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId", "ID"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId.Hint", "Enter Google Analytics ID."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.TrackingScript", "Tracking code with line"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.TrackingScript.Hint", "Paste the tracking code generated by Google Analytics here."); base.Install(); }
public GoogleAnalyticsPlugin(IWebHelper webHelper, ISettingService settingService, GoogleAnalyticsSettings googleAnalyticsSettings) { this._webHelper = webHelper; this._settingService = settingService; this._googleAnalyticsSettings = googleAnalyticsSettings; }
/// <summary> /// Install plugin /// </summary> public override void Install() { var settings = new GoogleAnalyticsSettings { GoogleId = "UA-0000000-0", TrackingScript = @"<!-- Google code for Analytics tracking --> <script type=""text/javascript""> var _gaq = _gaq || []; _gaq.push(['_setAccount', '{GOOGLEID}']); _gaq.push(['_trackPageview']); {ECOMMERCE} (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script>", }; _settingService.SaveSetting(settings); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId", "ID"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId.Hint", "Enter Google Analytics ID."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.TrackingScript", "Tracking code with {ECOMMERCE} line"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.TrackingScript.Hint", "Paste the tracking code generated by Google Analytics here. {GOOGLEID} and will be dynamically replaced."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EnableEcommerce", "Enable E-commerce"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EnableEcommerce.Hint", "Check to pass information about orders to Google E-commerce feature."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.IncludingTax", "Include tax"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.IncludingTax.Hint", "Check to include tax when generating tracking code for {ECOMMERCE} part."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.Instructions", "<p>Google Analytics is a free website stats tool from Google. It keeps track of statistics about the visitors and eCommerce conversion on your website.<br /><br />Follow the next steps to enable Google Analytics integration:<br /><ul><li><a href=\"http://www.google.com/analytics/\" target=\"_blank\">Create a Google Analytics account</a> and follow the wizard to add your website</li><li>Copy the Tracking ID into the 'ID' box below</li><li>Click the 'Save' button below and Google Analytics will be integrated into your store</li></ul><br />If you would like to switch between Google Analytics (used by default) and Universal Analytics, then please use the buttons below:</p>"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.Note", "<p><em>Please note that {ECOMMERCE} line works only when you have \"Disable order completed page\" order setting unticked.</em></p>"); base.Install(); }
/// <summary> /// Install plugin /// </summary> public override void Install() { var settings = new GoogleAnalyticsSettings { GoogleId = "UA-0000000-0", TrackingScript = @"<!-- Google code for Analytics tracking --> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '{GOOGLEID}', 'auto'); {CustomerID} ga('send', 'pageview'); </script>", }; _settingService.SaveSetting(settings); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId", "ID"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId.Hint", "Enter Google Analytics ID."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.TrackingScript", "Tracking code"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.TrackingScript.Hint", "Paste the tracking code generated by Google Analytics here. {GOOGLEID} and {CustomerID} will be dynamically replaced."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EnableEcommerce", "Enable E-commerce"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EnableEcommerce.Hint", "Check to pass information about orders to Google E-commerce feature."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.IncludeCustomerId", "Include customer ID"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.IncludeCustomerId.Hint", "Check to include customer identifier to script."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.IncludingTax", "Include tax"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.IncludingTax.Hint", "Check to include tax when generating tracking code for {ECOMMERCE} part."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.Instructions", "<p>Google Analytics is a free website stats tool from Google. It keeps track of statistics about the visitors and eCommerce conversion on your website.<br /><br />Follow the next steps to enable Google Analytics integration:<br /><ul><li><a href=\"http://www.google.com/analytics/\" target=\"_blank\">Create a Google Analytics account</a> and follow the wizard to add your website</li><li>Copy the Tracking ID into the 'ID' box below</li><li>Click the 'Save' button below and Google Analytics will be integrated into your store</li></ul><br />If you would like to switch between Google Analytics (used by default) and Universal Analytics, then please use the buttons below:</p>"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.Note", "<p><em>Please note that {ECOMMERCE} line works only when you have \"Disable order completed page\" order setting unticked.</em></p>"); base.Install(); }
/// <summary> /// Install plugin /// </summary> public override void Install() { var settings = new GoogleAnalyticsSettings { GoogleId = "UA-0000000-0", TrackingScript = @"<!-- Google code for Analytics tracking --> <script type=""text/javascript""> var _gaq = _gaq || []; _gaq.push(['_setAccount', '{GOOGLEID}']); _gaq.push(['_trackPageview']); {ECOMMERCE} (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script>", EcommerceScript = @"_gaq.push(['_addTrans', '{ORDERID}', '{SITE}', '{TOTAL}', '{TAX}', '{SHIP}', '{CITY}', '{STATEPROVINCE}', '{COUNTRY}']); {DETAILS} _gaq.push(['_trackTrans']); ", EcommerceDetailScript = @"_gaq.push(['_addItem', '{ORDERID}', '{PRODUCTSKU}', '{PRODUCTNAME}', '{CATEGORYNAME}', '{UNITPRICE}', '{QUANTITY}' ]); " }; _settingService.SaveSetting(settings); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId", "ID"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId.Hint", "Enter Google Analytics ID."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.TrackingScript", "Tracking code with {ECOMMERCE} line"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.TrackingScript.Hint", "Paste the tracking code generated by Google Analytics here. {GOOGLEID} and {ECOMMERCE} will be dynamically replaced."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EcommerceScript", "Tracking code for {ECOMMERCE} part, with {DETAILS} line"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EcommerceScript.Hint", "Paste the tracking code generated by Google analytics here. {ORDERID}, {SITE}, {TOTAL}, {TAX}, {SHIP}, {CITY}, {STATEPROVINCE}, {COUNTRY}, {DETAILS} will be dynamically replaced."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EcommerceDetailScript", "Tracking code for {DETAILS} part"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EcommerceDetailScript.Hint", "Paste the tracking code generated by Google analytics here. {ORDERID}, {PRODUCTSKU}, {PRODUCTNAME}, {CATEGORYNAME}, {UNITPRICE}, {QUANTITY} will be dynamically replaced."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.IncludingTax", "Include tax"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.IncludingTax.Hint", "Check to include tax when generating tracking code for {ECOMMERCE} part."); base.Install(); }
/// <summary> /// Install plugin /// </summary> public override void Install() { var settings = new GoogleAnalyticsSettings() { GoogleId = "UA-0000000-0", JavaScript = "<script type=\"text/javascript\"> var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\"); document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\")); </script> <script type=\"text/javascript\"> try { var pageTracker = _gat._getTracker(\"UA-0000000-0\"); pageTracker._trackPageview(); } catch(err) {}</script>", }; _settingService.SaveSetting(settings); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId", "ID"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId.Hint", "Enter Google Analytics ID."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.JavaScript", "Tracking code"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.JavaScript.Hint", "Paste the tracking code generated by Google Analytics here. This tracking code will be used to track when a new visitor arrives. You can then login to Google Analytics to view the customer's details including which site they came from and conversion details."); base.Install(); }
/// <summary> /// Install plugin /// </summary> public override void Install() { var settings = new GoogleAnalyticsSettings() { GoogleId = "UA-0000000-0", JavaScript = "<script type=\"text/javascript\"> var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\"); document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\")); </script> <script type=\"text/javascript\"> try { var pageTracker = _gat._getTracker(\"UA-0000000-0\"); pageTracker._trackPageview(); } catch(err) {}</script>", }; _settingService.SaveSetting(settings); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId", "ID"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId.Hint", "Enter Google Analytics ID."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.JavaScript", "Tracking code"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.JavaScript.Hint", "Paste the tracking code generated by Google Analytics here. This tracking code will be used to track when a new visitor arrives. You can then login to Google Analytics to view the customer's details including which site they came from and conversion details."); base.Install(); }
/// <summary> /// Install plugin /// </summary> public override void Install() { var settings = new GoogleAnalyticsSettings { GoogleId = "UA-0000000-0", TrackingScript = @"<!-- Global site tag (gtag.js) - Google Analytics --> <script async src='https://www.googletagmanager.com/gtag/js?id={GOOGLEID}'></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '{GOOGLEID}'); {CUSTOMER_TRACKING} {ECOMMERCE_TRACKING} </script>", UseJsToSendEcommerceInfo = true }; _settingService.SaveSetting(settings); _localizationService.AddPluginLocaleResource(new Dictionary <string, string> { ["Plugins.Widgets.GoogleAnalytics.GoogleId"] = "ID", ["Plugins.Widgets.GoogleAnalytics.GoogleId.Hint"] = "Enter Google Analytics ID.", ["Plugins.Widgets.GoogleAnalytics.TrackingScript"] = "Tracking code", ["Plugins.Widgets.GoogleAnalytics.TrackingScript.Hint"] = "Paste the tracking code generated by Google Analytics here. {GOOGLEID} and {CUSTOMER_TRACKING} will be dynamically replaced.", ["Plugins.Widgets.GoogleAnalytics.EnableEcommerce"] = "Enable eCommerce", ["Plugins.Widgets.GoogleAnalytics.EnableEcommerce.Hint"] = "Check to pass information about orders to Google eCommerce feature.", ["Plugins.Widgets.GoogleAnalytics.UseJsToSendEcommerceInfo"] = "Use JS to send eCommerce info", ["Plugins.Widgets.GoogleAnalytics.UseJsToSendEcommerceInfo.Hint"] = "Check to use JS code to send eCommerce info from the order completed page. But in case of redirection payment methods some customers may skip it. Otherwise, e-commerce information will be sent using HTTP request. Information is sent each time an order is paid but UTM is not supported in this mode.", ["Plugins.Widgets.GoogleAnalytics.IncludeCustomerId"] = "Include customer ID", ["Plugins.Widgets.GoogleAnalytics.IncludeCustomerId.Hint"] = "Check to include customer identifier to script.", ["Plugins.Widgets.GoogleAnalytics.IncludingTax"] = "Include tax", ["Plugins.Widgets.GoogleAnalytics.IncludingTax.Hint"] = "Check to include tax when generating tracking code for eCommerce part.", ["Plugins.Widgets.GoogleAnalytics.Instructions"] = "<p>Google Analytics is a free website stats tool from Google. It keeps track of statistics about the visitors and eCommerce conversion on your website.<br /><br />Follow the next steps to enable Google Analytics integration:<br /><ul><li><a href=\"http://www.google.com/analytics/\" target=\"_blank\">Create a Google Analytics account</a> and follow the wizard to add your website</li><li>Copy the Tracking ID into the 'ID' box below</li><li>Click the 'Save' button below and Google Analytics will be integrated into your store</li></ul><br />If you would like to switch between Google Analytics (used by default) and Universal Analytics, then please use the buttons below:</p>" }); base.Install(); }
/// <summary> /// Install plugin /// </summary> public override void Install() { var settings = new GoogleAnalyticsSettings { GoogleId = "UA-0000000-0", TrackingScript = @"<!-- Google code for Analytics tracking --> <script type=""text/javascript""> var _gaq = _gaq || []; _gaq.push(['_setAccount', '{GOOGLEID}']); _gaq.push(['_trackPageview']); {ECOMMERCE} (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script>", EcommerceScript = @"_gaq.push(['_addTrans', '{ORDERID}', '{SITE}', '{TOTAL}', '{TAX}', '{SHIP}', '{CITY}', '{STATEPROVINCE}', '{COUNTRY}']); {DETAILS} _gaq.push(['_trackTrans']); ", EcommerceDetailScript = @"_gaq.push(['_addItem', '{ORDERID}', '{PRODUCTSKU}', '{PRODUCTNAME}', '{CATEGORYNAME}', '{UNITPRICE}', '{QUANTITY}' ]); ", }; _settingService.SaveSetting(settings); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId", "ID"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.GoogleId.Hint", "Enter Google Analytics ID."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.TrackingScript", "Tracking code with {ECOMMERCE} line"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.TrackingScript.Hint", "Paste the tracking code generated by Google Analytics here. {GOOGLEID} and {ECOMMERCE} will be dynamically replaced."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EcommerceScript", "Tracking code for {ECOMMERCE} part, with {DETAILS} line"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EcommerceScript.Hint", "Paste the tracking code generated by Google analytics here. {ORDERID}, {SITE}, {TOTAL}, {TAX}, {SHIP}, {CITY}, {STATEPROVINCE}, {COUNTRY}, {DETAILS} will be dynamically replaced."); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EcommerceDetailScript", "Tracking code for {DETAILS} part"); this.AddOrUpdatePluginLocaleResource("Plugins.Widgets.GoogleAnalytics.EcommerceDetailScript.Hint", "Paste the tracking code generated by Google analytics here. {ORDERID}, {PRODUCTSKU}, {PRODUCTNAME}, {CATEGORYNAME}, {UNITPRICE}, {QUANTITY} will be dynamically replaced."); base.Install(); }
public GoogleAnalyticPlugin(ISettingService settingService, GoogleAnalyticsSettings googleAnalyticsSettings) { this._settingService = settingService; this._googleAnalyticsSettings = googleAnalyticsSettings; }
public GoogleAnalyticPlugin(ISettingService settingService, GoogleAnalyticsSettings googleAnalyticsSettings) { this._settingService = settingService; this._googleAnalyticsSettings = googleAnalyticsSettings; }