/// <summary> /// Install plugin /// </summary> public override async Task Install() { var settings = new GoogleAnalyticsEcommerceSettings { 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}' ]); ", }; await _settingService.SaveSetting(settings); await this.AddOrUpdatePluginLocaleResource(_serviceProvider, "Plugins.Widgets.GoogleAnalytics.GoogleId", "ID"); await this.AddOrUpdatePluginLocaleResource(_serviceProvider, "Plugins.Widgets.GoogleAnalytics.GoogleId.Hint", "Enter Google Analytics ID."); await this.AddOrUpdatePluginLocaleResource(_serviceProvider, "Plugins.Widgets.GoogleAnalytics.TrackingScript", "Tracking code with {ECOMMERCE} line"); await this.AddOrUpdatePluginLocaleResource(_serviceProvider, "Plugins.Widgets.GoogleAnalytics.TrackingScript.Hint", "Paste the tracking code generated by Google Analytics here. {GOOGLEID} and {ECOMMERCE} will be dynamically replaced."); await this.AddOrUpdatePluginLocaleResource(_serviceProvider, "Plugins.Widgets.GoogleAnalytics.EcommerceScript", "Tracking code for {ECOMMERCE} part, with {DETAILS} line"); await this.AddOrUpdatePluginLocaleResource(_serviceProvider, "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."); await this.AddOrUpdatePluginLocaleResource(_serviceProvider, "Plugins.Widgets.GoogleAnalytics.EcommerceDetailScript", "Tracking code for {DETAILS} part"); await this.AddOrUpdatePluginLocaleResource(_serviceProvider, "Plugins.Widgets.GoogleAnalytics.EcommerceDetailScript.Hint", "Paste the tracking code generated by Google analytics here. {ORDERID}, {PRODUCTSKU}, {PRODUCTNAME}, {CATEGORYNAME}, {UNITPRICE}, {QUANTITY} will be dynamically replaced."); await this.AddOrUpdatePluginLocaleResource(_serviceProvider, "Plugins.Widgets.GoogleAnalytics.IncludingTax", "Include tax"); await this.AddOrUpdatePluginLocaleResource(_serviceProvider, "Plugins.Widgets.GoogleAnalytics.IncludingTax.Hint", "Check to include tax when generating tracking code for {ECOMMERCE} part."); await base.Install(); }
public GoogleAnalyticsConsentCookie(GoogleAnalyticsEcommerceSettings googleAnalyticsEcommerceSettings) { _googleAnalyticsEcommerceSettings = googleAnalyticsEcommerceSettings; }