Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
This is by far the most frustrating issue I've run into with Shopify. I'm trying to optimize a client's site speed by wrapping up all their tracking codes into Google Tag Manager to reduce the total number of outgoing requests. I removed all hardcoded tracking pixels from theme.liquid and placed them in GTM, went through ALL the apps and sales channels and disconnected from accounts, but there are still extra codes being loaded by Trekkie.
I'm using the Shopify Facebook and Google Analytics integrations as recommended, so those are not represented in GTM. Even so, it's still somehow loading 2 Google Analytics, 2 Google Ads and 2 Facebook pixels.
As you can see in the source code, there are 2 facebook pixel ids contained within the Trekkie object, but how is this possible when there's only one place to add this information?
If I remove the facebook pixel id from this screen (Themes > Preferences), then the first pixel will not load, only the second unwanted pixel loads. The same issue persists for Google Analytics and Google Ads, except I cannot see multiple account ids in the source code, I can only see this in the network tab of DevTools and in the Google Tag Assistant.
I would typically assume that these codes must be in the theme code somewhere or an app or something, except I can actually see with DevTools that the code is being called by Trekkie.
This is driving me absolutely crazy and I've already spent lots of time trying to make what I thought should be a simple optimization. If anyone can help with this issue I'd be hugely appreciative.
Thanks!
Solved! Go to the solution
This is an accepted solution.
Hi @plasmablobs , I actually found a solution, hacky though it may be. Comment out the first "content_for_header" instance, and then use a Liquid replace string filter to remove the specific pixel id and replace it with an empty string. It looks like this.
{% comment %}{{ content_for_header }}{% endcomment %}
{{ content_for_header | replace: '12345', '' }}
Inspect the source code on your site to find the pixel id you don't want and use that instead of '12345'.
Here's the link that helped me find this answer: https://community.shopify.com/c/Shopify-Discussion/Shopify-Trekkie/td-p/358102 (scroll down to Subhranil's answer)
It's so frustrating that 3rd parties can bog down stores with unwanted code like this. I wish Shopify would give us a solution for this.
Hi,
I've just spotted the same on my site. I was trying to stop one pixel from loading as it's unwanted and it cannot be deleted of course. I believe it's slowing down the performance unnecessarily according to Page Insights.
I have the facebook sales channel apps: Facebook Shop, Instagram and Facebook. I've now deleted Facebook as it's not adding any value yet until they combine Facebook Shop and Instagram together. That hasn't sorted it though.
Any help would be appreciated.
Cheers!
This is an accepted solution.
Hi @plasmablobs , I actually found a solution, hacky though it may be. Comment out the first "content_for_header" instance, and then use a Liquid replace string filter to remove the specific pixel id and replace it with an empty string. It looks like this.
{% comment %}{{ content_for_header }}{% endcomment %}
{{ content_for_header | replace: '12345', '' }}
Inspect the source code on your site to find the pixel id you don't want and use that instead of '12345'.
Here's the link that helped me find this answer: https://community.shopify.com/c/Shopify-Discussion/Shopify-Trekkie/td-p/358102 (scroll down to Subhranil's answer)
It's so frustrating that 3rd parties can bog down stores with unwanted code like this. I wish Shopify would give us a solution for this.
man, thank you so so much!
So... I found out that this disease is also on the "Thank you"-Page (Order Status page). There is an old FB Pixel. I meanwhile have a new one pasted in the scripts section (and deleted the old!) but the old one is stil shown in the FB Pixel helper... So, how can I delete this disease?
Hi @Humming_bird ,
Sorry for the late reply. I ended up removing Kit and it sorted it.
I didn't want to but it's stopped the facebook javascript loading twice and slowing the site down. I guess this is Facebook's problem for not allowing unwanted pixels to be deleted.
Shopify Kit should have a settings option to select which pixels you want. I'll bear your solution in mind should I reenable Kit again.
Thanks,
Dan.
Hi there @Humming_bird
where exactly would I place those two lines of code? Does this go in a .liquid file we access through shopify backend or...
thanks!
Hey @Humming_bird and others on this thread,
I implemented the code you provided, and this removed the original instance of the pixel added within trekkie.load({}), however the pixel is still showing in Facebook Pixel Helper due to the <script> tags still being present.
Anyone know how to get rid of this entirely?
Thanks in advance.
Hey @killer_waves ,
If the <script> tag is showing up that means that the script is being loaded from somewhere else via JavaScript since I couldn't find it in the source code. Do you have a facebook app installed on your store? I'd check some Apps you have installed since that might be the culprit.
Hi Guys,
I'm having a similar problem where i see a pixel code in pixel helper but this code does not show in any of the source code and is not mine.
How can i find and delete it? Also if i click to view analytics it doesn't take me to any of my accounts.
Your help would be much appreciated.
thanks
I am having this same problem - at least 2 extra pixels! - but I have none of the developer skills that you all seem to have.
Can someone please recommend a reliable person to fix this for me?
Need: someone to remove extra pixels
Site: store.anniekip.com
Contact me at: annie@anniekip.com
Thanks! -Annie
Hi Annie, did you find someone to help you with that?
If yes, please, share the contact: lrfgdrr@gmail.com
Thanks.
Hi and thanks for the replies.
I found that Shopify’s Kit add-in was bringing in the duplicate pixel, so I regretfully removed the app.
That said, given the solution I may add it back in. I’ll test out the solution. Would be good if Shopify sorted Kit out.
Thanks,
Dan
Is this still working for anyone?
I had this implemented on our store a week ago and working like a (hacky) dream but this morning it's stopped working. That pixel is still being pulled through. It's like Shopify has locked all the Trekkie stuff away from any filters.
Same issue here. Any solution out there?
I think that this solution is not working any more.
Kindly provide new instructions on how to disable the facebook pixel generated by Trekkie.
Looking forward to your reply
Indead it is not working anymore.....
I've seen 3rd party apps inject their own fb pixel. I don't agree with it but I understand it (making sure the data necessary gets loaded). In these cases I've requested the app to not inject it and they've complied.
Another thing you can investigate is what's loading in the {{ content_for_header }} section (inserted in the <head> and loads injected scripts that aren't part of the theme assets).
Assuming there is no leftover app code loading in the theme files (from uninstalled apps), then I think that content_for_header area my provide some clues to your extra resources loading.
The FB pixel helper plugin could provide some insights on who's loading it.
I also ran into this problem: site A was showing pixels for site A and B, and it turns out that what fixed it was removing the Facebook app from our Shopify site.
It turns out that I used the Facebook Shopify app at one point (with the tracking pixel for site B), but then signed out of Facebook in the app. Even though I signed out, the pixel was still being loaded by Shopify onto all of our pages. Deleting the app removed the extra pixel.
thanks for sharing. I had the same problem and this fixed it for me.
as of this writing. I resolved this by going to the Google Sales Channel, disconnecting the google ads account. I guess the connected google merchant center should have the google ads conntected to it already. I'm just using the Google Sales Channel to provide data feed to Google Merchant Center and nothing else so disconnecting the Google Ads wont hurt at all but will resolved the added events on trekkie.load.
Hi, but can you still using Google ads for campaigns?
Hey @Humming_bird I am on the same boat, I hate the performance drop that Im getting on my website due to so many of these and there is not easy way to get rid of them or "defer" them instead of "async".
Anyways, you mentioned "I removed all hardcoded tracking pixels from theme.liquid and placed them in GTM"
which codes are for pixel and how did you switch them over? I think im gonna only keep the google analytics and get rid of the rest (I was also hoping to do the googletagmanager defer script, eventhough it might break some of its functionality I would rather not wait for it to load the page)
any help is appreciated!
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024