Personalized checkout and custom promotions with Shopify Scripts
Hello,
My shopify analytics do not work since optimizing my theme last year february 2023.
I did not make the right back-up and since then shopify tracking does not work. Also my email conversions are not measured since then.
Does anybody know how I, can get them up and running again?
I would almost rebuild my entire store
My store is www.uwdiervoeding.nl
Kind regards
Stan Legebeke
Hi @stanlegebeke
I checked the store through the URL and found that the code for analytics is Lazy loaded.
To remove that, you can edit the theme, search the file theme.liquid, and find the code below. Once the code will be remove the analytics will work properly.
const observer = new MutationObserver(e => { e.forEach(({ addedNodes: e }) => { e.forEach(e => { 1 === e.nodeType && "SCRIPT" === e.tagName && (e.innerHTML.includes("asyncLoad") && (e.innerHTML = e.innerHTML.replace("if(window.attachEvent)", "document.addEventListener('asyncLazyLoad',function(event){asyncLoad();});if(window.attachEvent)").replaceAll(", asyncLoad", ", function(){}")), e.innerHTML.includes("PreviewBarInjector") && (e.innerHTML = e.innerHTML.replace("DOMContentLoaded", "asyncLazyLoad")), (e.className == 'analytics') && (e.type = 'text/lazyload'),(e.src.includes("assets/storefront/features")||e.src.includes("assets/shopify_pay")||e.src.includes("connect.facebook.net"))&&(e.setAttribute("data-src", e.src), e.removeAttribute("src")))})})});observer.observe(document.documentElement,{childList:!0,subtree:!0})
Hello, thanks for replying. When I search through the theme liquid. I cannot seem to find this code with ctrl f: const observer = new MutationObserver(e => { e.forEach(({ addedNodes: e }) => { e.forEach(e => { 1 === e.nodeType && "SCRIPT" === e.tagName && (e.innerHTML.includes("asyncLoad") && (e.innerHTML = e.innerHTML.replace("if(window.attachEvent)", "document.addEventListener('asyncLazyLoad',function(event){asyncLoad();});if(window.attachEvent)").replaceAll(", asyncLoad", ", function(){}")), e.innerHTML.includes("PreviewBarInjector") && (e.innerHTML = e.innerHTML.replace("DOMContentLoaded", "asyncLazyLoad")), (e.className == 'analytics') && (e.type = 'text/lazyload'),(e.src.includes("assets/storefront/features")||e.src.includes("assets/shopify_pay")||e.src.includes("connect.facebook.net"))&&(e.setAttribute("data-src", e.src), e.removeAttribute("src")))})})});observer.observe(document.documentElement,{childList:!0,subtree:!0})
Can I send you a collaborator request.
Kind regards
Stan Legebeke
I cannot seem to find it in my theme.liquid, theme.js liquid and my theme.scss liquid.
@stanlegebeke
Please share the collab. request code in message,
Hello, Here is the code.
8326
Kind regards
Stan Legebeke
Hi @stanlegebeke
I requested the access can you please check it?
The code was added in this file social-meta-tags.liquid at the end of the file.
I just removed the code. It may take some time to load the analytics data.
Please check it.
Hello I checked it during the day. But we have around 60 to 100 visitors everyday from the netherlands. Here it does not show it in the dashboard.
It is collecting some data but not like we did.
We had 3 orders since you changed it but also the orders are not tracked. There is no conversion rate etc.
Hi @stanlegebeke
It will take some time to load all the data correctly: You can find more details here: https://help.shopify.com/en/manual/reports-and-analytics/shopify-reports/overview-dashboard#data-on-...
Hello,
I waited some time but still it doesn't show correcly. as an example I had 69 clicks on google ads 2 feb but shopify shows 16 sessions without a conversion.
Kind regards
Stan Legebeke
2m ago Learn the essential skills to navigate the Shopify admin with confidence. T...
By Shopify Feb 12, 2025Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025