public override void Install() { FacebookPixelSettings facebookPixelSetting = new FacebookPixelSettings() { FacebookPixelScriptFirstPart = "<!-- Facebook Pixel Code -->\r\n<script>\r\n !function (f, b, e, v, n, t, s) {\r\n if (f.fbq) return; n = f.fbq = function () {\r\n n.callMethod ?\r\n n.callMethod.apply(n, arguments) : n.queue.push(arguments)\r\n }; if (!f._fbq) f._fbq = n;\r\n n.push = n; n.loaded = !0; n.version = '2.0'; n.queue = []; t = b.createElement(e); t.async = !0;\r\n t.src = v; s = b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t, s)\r\n }(window,\r\n document, 'script', '//connect.facebook.net/en_US/fbevents.js');\r\n\r\n fbq('init', '1769980523222843')", FacebookPixelScriptLastPart = "fbq('track', \"PageView\");</script>\r\n<noscript>\r\n <img height=\"1\" width=\"1\" style=\"display:none\"\r\n src=\"https://www.facebook.com/tr?id=1769980523222843&ev=PageView&noscript=1\" />\r\n</noscript>\r\n<!-- End Facebook Pixel Code -->" }; this._settingService.SaveSetting <FacebookPixelSettings>(facebookPixelSetting, 0); LocalizationExtensions.AddOrUpdatePluginLocaleResource(this, "Plugins.Widgets.FacebookPixel.Configure.Description", "\r\n\r\n<ul>\r\n <li>The Facebook Pixel code divided into two part </li>\r\n <li>First parts start from <!-- Facebook Pixel Code --> and end fbq('init', '111111111111');</li>\r\n <li>Second parts start from fbq('track', \"PageView\"); and end <!-- End Facebook Pixel Code -->;</li>\r\n <li>Two script Part put into the two different text feld</li>\r\n <li>Save</li>\r\n</ul>\r\n\r\n", null); LocalizationExtensions.AddOrUpdatePluginLocaleResource(this, "Plugins.Widgets.FacebookPixel.FacebookPixelScriptFirstPart", "FacebookPixel Script_First", null); LocalizationExtensions.AddOrUpdatePluginLocaleResource(this, "Plugins.Widgets.FacebookPixel.FacebookPixelScriptFirstPart.Hint", "Paste the FacebookPixel Script here, and replace hard coded values by tokens. http will be automatically replaced with https if necessary.", null); LocalizationExtensions.AddOrUpdatePluginLocaleResource(this, "Plugins.Widgets.FacebookPixel.FacebookPixelScriptLastPart", "FacebookPixel Script_Last", null); LocalizationExtensions.AddOrUpdatePluginLocaleResource(this, "Plugins.Widgets.FacebookPixel.FacebookPixelScriptLastPart.Hint", "Paste the FacebookPixel Script Last here, and replace hard coded values by tokens. http will be automatically replaced with https if necessary.", null); base.Install(); }
public FacebookPixelPlugin(IWebHelper webHelper, ISettingService settingService, FacebookPixelSettings facebookPixelSettings) { this._webHelper = webHelper; this._settingService = settingService; this._facebookPixelSettings = facebookPixelSettings; }