SEO, AdWords, affiliates, advertising, and promotions
We are running www.italianmarket.asia and we have observed that on our page we have double code of GG Analytic. And they double count the visits, how to remove this double code with the same UI number?
<script>window.ShopifyAnalytics = window.ShopifyAnalytics || {};
window.ShopifyAnalytics.meta = window.ShopifyAnalytics.meta || {};
window.ShopifyAnalytics.meta.currency = 'SGD';
var meta = {"page":{"pageType":"home"},"page_view_event_id":"1ad9dc6fb0d343ebde836b8ef79c65488adb1cc1d8c1ec7df12381f051924934","cart_event_id":"d71dfc7a2ea1a5e94c97b6da313c09eac0c18d3a3b4019784d5a327288505fbe"};
for (var attr in meta) {
window.ShopifyAnalytics.meta[attr] = meta[attr];
}</script>
<script>window.ShopifyAnalytics.merchantGoogleAnalytics = function() {
<!-- Global site tag (gtag.js) - Google Analytics -->
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-111513536-1');
};
</script>
<script class="analytics">(window.gaDevIds=window.gaDevIds||[]).push('BwiEti');
(function(__config, __setUpTrackingServices, __pages, __tracks){
var customDocumentWrite = function(content) {
var jquery = null;
if (window.jQuery) {
jquery = window.jQuery;
} else if (window.Checkout && window.Checkout.$) {
jquery = window.Checkout.$;
}
if (jquery) {
jquery('body').append(content);
}
};
var hasLoggedConversion = function(token) {
if (token) {
return document.cookie.indexOf('loggedConversion=' + token) !== -1;
}
return false;
}
var setCookieIfConversion = function(token) {
if (token) {
var twoMonthsFromNow = new Date(Date.now());
twoMonthsFromNow.setMonth(twoMonthsFromNow.getMonth() + 2);
document.cookie = 'loggedConversion=' + token + '; expires=' + twoMonthsFromNow;
}
}
var trekkie = window.ShopifyAnalytics.lib = window.trekkie = window.trekkie || [];
if (trekkie.integrations) {
return;
}
trekkie.methods = [
'identify',
'page',
'ready',
'track',
'trackForm',
'trackLink'
];
trekkie.factory = function(method) {
return function() {
var args = Array.prototype.slice.call(arguments);
args.unshift(method);
trekkie.push(args);
return trekkie;
};
};
for (var i = 0; i < trekkie.methods.length; i++) {
var key = trekkie.methods[i];
trekkie[key] = trekkie.factory(key);
}
function trekkieLoadErrorJavascript(app_name, source_url) {
var Monorail = {
produce: function produce(monorailDomain, schemaId, payload) {
var currentMs = new Date().getTime();
var event = {
schema_id: schemaId,
payload: payload,
metadata: {
event_created_at_ms: currentMs,
event_sent_at_ms: currentMs
}
};
return Monorail.sendRequest("https://" + monorailDomain + "/v1/produce", JSON.stringify(event));
},
sendRequest: function sendRequest(endpointUrl, payload) {
// Try the sendBeacon API
if (window && window.navigator && typeof window.navigator.sendBeacon === 'function' && typeof window.Blob === 'function' && !Monorail.isIos12()) {
var blobData = new window.Blob([payload], {
type: 'text/plain'
});
if (window.navigator.sendBeacon(endpointUrl, blobData)) {
return true;
} // sendBeacon was not successful
} // XHR beacon
var xhr = new XMLHttpRequest();
try {
xhr.open('POST', endpointUrl);
xhr.setRequestHeader('Content-Type', 'text/plain');
xhr.send(payload);
} catch (e) {
console.log(e);
}
return false;
},
isIos12: function isIos12() {
return window.navigator.userAgent.lastIndexOf('iPhone; CPU iPhone OS 12_') !== -1 || window.navigator.userAgent.lastIndexOf('iPad; CPU OS 12_') !== -1;
}
};
Monorail.produce(__config.monorail.domain, __config.monorail.schema, __config.monorail.payload);
}
trekkie.load = function(config) {
trekkie.config = config;
var first = document.getElementsByTagName('script')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.onerror = function(e) {
var scriptFallback = document.createElement('script');
scriptFallback.type = 'text/javascript';
scriptFallback.onerror = function(error) {
trekkieLoadErrorJavascript(__config.appName, __config.trekkieSourcePath)
};
scriptFallback.async = true;
scriptFallback.src=__config.trekkieSourcePath;
first.parentNode.insertBefore(scriptFallback, first);
};
script.async = true;
script.src=__config.trekkieSourcePath;
first.parentNode.insertBefore(script, first);
};
trekkie.load(__setUpTrackingServices);
function googleAnalyticsTrackerCode() {
ga('require', 'linker');
function addListener(element, type, callback) {
if (element.addEventListener) {
element.addEventListener(type, callback);
} else if (element.attachEvent) {
element.attachEvent('on' + type, callback);
}
}
function decorate(event) {
event = event || window.event;
var target = event.target || event.srcElement;
if (target && (target.getAttribute('action') || target.getAttribute('href'))) {
ga(function(tracker) {
var linkerParam = tracker.get('linkerParam');
document.cookie = '_shopify_ga=' + linkerParam + '; ' + 'path=/';
});
}
}
addListener(window, 'load', function() {
for (var i = 0; i < document.forms.length; i++) {
var action = document.forms[i].getAttribute('action');
if (action && action.indexOf('/cart') >= 0) {
addListener(document.forms[i], 'submit', decorate);
}
}
for (var i = 0; i < document.links.length; i++) {
var href = document.links[i].getAttribute('href');
if (href && href.indexOf('/checkout') >= 0) {
addListener(document.links[i], 'click', decorate);
}
}
});
}
function boomerangAnalyticsTrackerCode() {
if (window.BOOMR && (window.BOOMR.version || window.BOOMR.snippetExecuted)) {
return;
}
window.BOOMR = window.BOOMR || {};
window.BOOMR.snippetStart = new Date().getTime();
window.BOOMR.snippetExecuted = true;
window.BOOMR.snippetVersion = 12;
window.BOOMR.application = "storefront-renderer";
window.BOOMR.themeName = `${__config.theme.name}`;
window.BOOMR.themeVersion = `${__config.theme.version}`;
window.BOOMR.shopId = __config.shopId;
window.BOOMR.themeId = __config.theme.id;
window.BOOMR.url =
"https://" + __config.cdnHost + "/shopifycloud/boomerang/shopify-boomerang-1.0.0.min.js";
var where = document.currentScript || document.getElementsByTagName("script")[0];
var parentNode = where.parentNode;
var promoted = false;
var LOADER_TIMEOUT = 3000;
function promote() {
if (promoted) {
return;
}
var script = document.createElement("script");
script.id = "boomr-scr-as";
script.src=window.BOOMR.url;
script.async = true;
parentNode.appendChild(script);
promoted = true;
}
function iframeLoader(wasFallback) {
promoted = true;
var dom, bootstrap, iframe, iframeStyle;
var doc = document;
var win = window;
window.BOOMR.snippetMethod = wasFallback ? "if" : "i";
bootstrap = function(parent, scriptId) {
var script = doc.createElement("script");
script.id = scriptId || "boomr-if-as";
script.src=window.BOOMR.url;
BOOMR_lstart = new Date().getTime();
parent = parent || doc.body;
parent.appendChild(script);
};
if (!window.addEventListener && window.attachEvent && navigator.userAgent.match(/MSIE [67]\./)) {
window.BOOMR.snippetMethod = "s";
bootstrap(parentNode, "boomr-async");
return;
}
iframe = document.createElement("IFRAME");
iframe.src="about:blank";
iframe.title = "";
iframe.role = "presentation";
iframe.loading = "eager";
iframeStyle = (iframe.frameElement || iframe).style;
iframeStyle.width = 0;
iframeStyle.height = 0;
iframeStyle.border = 0;
iframeStyle.display = "none";
parentNode.appendChild(iframe);
try {
win = iframe.contentWindow;
doc = win.document.open();
} catch (e) {
dom = document.domain;
iframe.src="x-javascript:var d=document.open();d.domain='" + dom + "';void(0);";
win = iframe.contentWindow;
doc = win.document.open();
}
if (dom) {
doc._boomrl = function() {
this.domain = dom;
bootstrap();
};
doc.write("<body onload='document._boomrl();'>");
} else {
win._boomrl = function() {
bootstrap();
};
if (win.addEventListener) {
win.addEventListener("load", win._boomrl, false);
} else if (win.attachEvent) {
win.attachEvent("onload", win._boomrl);
}
}
doc.close();
}
var link = document.createElement("link");
if (link.relList &&
typeof link.relList.supports === "function" &&
link.relList.supports("preload") &&
("as" in link)) {
window.BOOMR.snippetMethod = "p";
link.href = window.BOOMR.url;
link.rel = "preload";
link.as = "script";
link.addEventListener("load", promote);
link.addEventListener("error", function() {
iframeLoader(true);
});
setTimeout(function() {
if (!promoted) {
iframeLoader(true);
}
}, LOADER_TIMEOUT);
BOOMR_lstart = new Date().getTime();
parentNode.appendChild(link);
} else {
iframeLoader(false);
}
function boomerangSaveLoadTime(e) {
window.BOOMR_onload = (e && e.timeStamp) || new Date().getTime();
}
if (window.addEventListener) {
window.addEventListener("load", boomerangSaveLoadTime, false);
} else if (window.attachEvent) {
window.attachEvent("onload", boomerangSaveLoadTime);
}
if (document.addEventListener) {
document.addEventListener("onBoomerangLoaded", function(e) {
e.detail.BOOMR.init({
producer_url: `${__config.producerUrl}`,
ResourceTiming: {
enabled: true,
trackedResourceTypes: ["script", "img", "css"]
},
});
e.detail.BOOMR.t_end = new Date().getTime();
});
} else if (document.attachEvent) {
document.attachEvent("onpropertychange", function(e) {
if (!e) e = event;
if (e.propertyName === "onBoomerangLoaded") {
e.detail.BOOMR.init({
producer_url: `${__config.producerUrl}`,
ResourceTiming: {
enabled: true,
trackedResourceTypes: ["script", "img", "css"]
},
});
e.detail.BOOMR.t_end = new Date().getTime();
}
});
}
}
var loaded = false;
trekkie.ready(function() {
if (loaded) return;
loaded = true;
window.ShopifyAnalytics.lib = window.trekkie;
if (__config.useGoogleAnalytics) googleAnalyticsTrackerCode();
var originalDocumentWrite = document.write;
document.write = customDocumentWrite;
try {
window.ShopifyAnalytics.merchantGoogleAnalytics.call(this);
} catch (error) {};
document.write = originalDocumentWrite;
boomerangAnalyticsTrackerCode()
__pages();
var match = window.location.pathname.match(/checkouts\/(.+)\/(thank_you|post_purchase)/)
var token = match ? match[1] : undefined;
if (!hasLoggedConversion(token)) {
setCookieIfConversion(token);
__tracks();
}
});
function shopEventsListenerCode() {
var eventsListenerScript = document.createElement('script');
eventsListenerScript.async = true;
eventsListenerScript.src=`${__config.shopEventsListenerUrl}`;
document.getElementsByTagName('head')[0].appendChild(eventsListenerScript);
}
shopEventsListenerCode();
})(
{"shopId":26888405094,"cdnHost":"//cdn.shopify.com","producerUrl":"https://monorail-edge.shopifysvc.com/v1/produce","appName":"storefront","useGoogleAnalytics":true,"t..."}}},
{"Trekkie":{"appName":"storefront","development":false,"defaultAttributes":{"shopId":26888405094,"isMerchantRequest":null,"themeId":81739808870,"themeCityHash":"8406852102012762578","contentLanguage":"en","currency":"SGD"},"isServerSideCookieWritingEnabled":true,"isPixelGateEnabled":true},"Performance":{"navigationTimingApiMeasurementsEnabled":true,"navigationTimingApiMeasurementsSampleRate":1},"Google Analytics":{"trackingId":"
","domain":"auto","siteSpeedSampleRate":"10","enhancedEcommerce":true,"doubleClick":true,"includeSearch":true},"Facebook Pixel":{"pixelIds":["586360258633969"],"agent":"plshopify1.2","conversionsAPIEnabled":true},"Google Gtag Pixel":{"conversionId":"AW-729959150","eventLabels":[{"type":"page_view","action_label":"AW-729959150/btqbCOaWruQBEO6VidwC"},{"type":"purchase","action_label":"AW-729959150/zT-6COmWruQBEO6VidwC"},{"type":"view_item","action_label":"AW-729959150/PlA2COyWruQBEO6VidwC"},{"type":"add_to_cart","action_label":"AW-729959150/BDYNCO-WruQBEO6VidwC"},{"type":"begin_checkout","action_label":"AW-729959150/CEzaCPKWruQBEO6VidwC"},{"type":"search","action_label":"AW-729959150/k5NACPWWruQBEO6VidwC"},{"type":"add_payment_info","action_label":"AW-729959150/1NxnCPiWruQBEO6VidwC"}],"targetCountry":"SG"},"Session Attribution":{}},
function(){
window.ShopifyAnalytics.lib.page(
null,
{"pageType":"home"},
"1ad9dc6fb0d343ebde836b8ef79c65488adb1cc1d8c1ec7df12381f051924934"
);
},
function(){}
)</script>
Solved! Go to the solution
This is an accepted solution.
Hi,
Thanks for your feedback but at the Step 3 there's no code at all in the theme.liquid.
That's the reason we are in difficult to understand from where this pops out.
Ok, got it!
Thanks it's double input from here: myshopify.com/admin/online_store/preferences
You can do these steps:
Step 1: go to edit theme from the administration page.
Step 2: click theme.liquid
Step 3: Ctrl + F and type 111513536-1
If it displays 2 results you will just delete 1 result:
<!-- Global site tag (gtag.js) - Google Analytics -->
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-111513536-1');
};
</script>
Cheers,
SEO Booster
This is an accepted solution.
Hi,
Thanks for your feedback but at the Step 3 there's no code at all in the theme.liquid.
That's the reason we are in difficult to understand from where this pops out.
Ok, got it!
Thanks it's double input from here: myshopify.com/admin/online_store/preferences
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024