Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Re: Shopify Trekkie loading extra tracking Pixels

Solved

Shopify Trekkie loading extra tracking Pixels

Humming_bird
Shopify Partner
6 1 8

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)
Humming_bird
Shopify Partner
6 1 8

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 24 (24)

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!

Humming_bird
Shopify Partner
6 1 8

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
Tourist
4 0 1

man, thank you so so much!

Xselar
Tourist
4 0 1

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.

ragdoll
Visitor
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
Visitor
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
Shopify Partner
6 1 8

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. 

gatorgator
Visitor
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
4 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

MamaBabyTime
Visitor
3 0 0

Hi Annie, did you find someone to help you with that?

 

If yes, please, share the contact: lrfgdrr@gmail.com

 

Thanks.

anniekip
New Member
4 0 0
Yes, I fixed the problem - thank you for letting me know!!!!
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

nichharp
Shopify Partner
20 4 19

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.

ogeid
Shopify Partner
68 0 23

Same issue here. Any solution out there?

D.E.W. L.A. - Web Design
https://dew.la
aquaanimation
Visitor
1 0 0

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

MamaBabyTime
Visitor
3 0 0

Indead it is not working anymore.....

anniekip
New Member
4 0 0
Oh my gosh. So sorry about that - my (big) mistake!

The code THANKS20 is active now - please let me know if you have any
trouble.

Thank you for letting me know!!!! I really appreciate it.

JoesIdeas
Shopify Partner
2442 225 658

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 [auto tag, fulfill, connect FBA, daily jobs]
• Co-Creator of Product Automator [suite of features for products / collections]
• Shopify developer for 10+ years, store owner for 7 years
• Blog: Shopify Tips, Guides, and Automation Tactics

tgadf
Shopify Partner
4 0 44

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.

maxbruhn
Shopify Partner
6 0 0

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

KevinBasina
Visitor
1 0 0

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.2023-01-08_10-54.png

luiscamp
Visitor
2 0 0

Hi, but can you still using Google ads for campaigns?

moosaes
Tourist
8 0 0

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!