Shopify Trekkie loading extra tracking Pixels

Solved
Humming_bird
Tourist
6 1 7

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.

image.png

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?

image.png

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.

image.png

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. 

image.png

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!

Accepted Solution (1)

Accepted Solutions
Humming_bird
Tourist
6 1 7

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.

View solution in original post

Replies 15 (15)
plasmablobs
Excursionist
11 1 4

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!

JoesIdeas
Shopify Expert
1669 143 428

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.

• Creator of Order Automator (automation app to save you and your team time on admin tasks)
• Shopify developer for +10 years
• Contributor on the Speed Boostr blog
• Guy who likes to help people
Humming_bird
Tourist
6 1 7

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.

Xselar
New Member
3 0 0

man, thank you so so much!

Xselar
New Member
3 0 0

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?

plasmablobs
Excursionist
11 1 4

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.

tgadf
Shopify Partner
4 0 25

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.

equlii
Tourist
5 0 0

thanks for sharing. I had the same problem and this fixed it for me.

ragdoll
New Member
2 0 0

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!

 

killer_waves
New Member
1 0 0

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.

Screen Shot 2021-04-29 at 2.20.31 PM copy.png

Screen Shot 2021-04-29 at 2.20.40 PM copy.png

Anyone know how to get rid of this entirely?

Thanks in advance.

Humming_bird
Tourist
6 1 7

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. 

plasmablobs
Excursionist
11 1 4

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

gatorgator
New Member
3 0 0

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. 

gatorgator_0-1621328898494.png

Your help would be much appreciated. 

thanks

anniekip
New Member
2 0 0

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

nichharp
Excursionist
15 3 13

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.