(function (w, d) { var dynamicPixel = function() { var pixelURL = "https://a.remarketstats.com/px/smart/?c=24d1add2443e239&partner_id=1xxtx0ufdGnU6Gmqm&partner_rid=b5fccc62%2de8e9%2d4f98%2d85f0%2dcc04b54792c8&type=img&seg="; var urlPath = w.location.pathname.substr(1).replace(/\/+$/, ''); if (urlPath === "") { urlPath = "home"; } console.log(urlPath); var segmentValue = urlPath; var script = d.createElement('script'); if (pixelURL.indexOf("seg=") === -1) { pixelURL = pixelURL + "seg="; } script.src = pixelURL + escape(segmentValue); d.getElementsByTagName('script')[0].parentNode.appendChild(script); }; var body = d.getElementsByTagName('body')[0]; if (body) { dynamicPixel(); } else { w.onload = function () { dynamicPixel(); } } })(window, document);