Shopify Trekkie loading extra tracking Pixels

Solved
Humming_bird
Tourist
5 1 6

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!

plasmablobs
Excursionist
11 1 2

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!

0 Likes
JoesIdeas
Shopify Expert
1310 118 341

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.

Founder of Speed Boostr (Shopify optimization experts, theme customization, custom app development).
Creator of Shopify Analyzer (first performance analysis tool for Shopify sites, free for the Shopify community).
Creator of Order Automator (auto tag orders and customers + auto fulfillment + more automations).
More apps: Theme Scientist (A/B testing), Tip Jar (add a tip button), File Optimizer (optimize CSS, JS, Liquid).
0 Likes
Humming_bird
Tourist
5 1 6

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!

0 Likes
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?

0 Likes
plasmablobs
Excursionist
11 1 2

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.

0 Likes
tgadf
Shopify Partner
4 0 11

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.

0 Likes
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!

 

0 Likes