New Shopify Certification now available: Liquid Storefronts for Theme Developers

Facebook Pixel: Purchase Event firing Twice

Solved
DenisG0
Tourist
8 1 3

Hi All,

I have been stuck on this one for awhile so any help would be greatly appreciated. I have moved to manual pixel code for reasons and things have been working smoothly except the Purchase event. For some reason, it is reporting twice on facebook analytics. I believe i have everything done correctly. Removed the pixel id from shopify integrations. Add the proper checkout code and wrapped it in first time access. Am i missing a crucial step? Is this a bug? Would appreciate any assistance you can offer.

 

Thank you. 

Accepted Solution (1)
DenisG0
Tourist
8 1 3

This is an accepted solution.

What finally resolved this double activation was checking for the instance of fbq. 
So inside the first_time_accessed, having an additional conditional check:

if(typeof fbq === 'undefined') {
}

Thank you to all that responded and tried to help. 

View solution in original post

Replies 21 (21)
Josh_Uebergang
Shopify Expert
1003 42 264

Paste the code you are using here. Use the Facebook Pixel Helper Chrome extension to confirm a pixel or two different ones are firing the Purchase event. View the source code to see where these Pixel IDs are located and firing. Perhaps you have Google Tag Manager firing another pixel or sometimes third-party apps.

Run Google Shopping ads? Get the free definitive guide to Google Shopping for Shopify (no optin required): https://www.digitaldarts.com.au/google-shopping
DenisG0
Tourist
8 1 3

 

{% if first_time_accessed %}
<script> !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n; n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window, document,'script','//connect.facebook.net/en_US/fbevents.js'); // Insert Your Facebook Pixel ID below. fbq('init', '00000000000'); fbq('track', 'Purchase', { content_ids: [{% for item in order.line_items %}'{{item.sku}}',{% endfor %}], content_type: 'product', value:'{{ subtotal_price | money_without_currency | remove: ','}}', currency: 'GBP', }); </script>
{% endif %}

The checkout code does contain other event listeners but they are for for google tag, bing and pinterest. I was unable to properly test the event using pixel helper as turning the site to test mode is not allowed. I have been working with live data and noticed double conversions for every purchase event as soon as i made the switch. No other event is reported twice... Thank you for responding. 

 

DenisG0
Tourist
8 1 3

After checking the events in purchase. It is indeed fired twice. However looking in the html code, when searching by pixel ID, i find only one instance of the pixel being initiated, the purchase event code i pasted. 
The console log does show this: 
image.png

Does Shopify checkout code mess with facebook pixel code?

EVRYBDY
Visitor
3 0 3

Hello Josh,

 

I have the exact problem with this. Can you please help me? I have been in contact with both Shopify and facebook regarding this. For some reason it shows that I have 22 website purchases today when I only have 2. It feels like the pixel triggers on any action at all on the website.

 

 

 

 

EricMO
Visitor
2 0 0

Help! Same problem like user EVRYBDY. 😞 As I understand, the solution is to paste the script into Shopify Checkout -> Additional Scripts? 

Is this the script to paste? Can someone confirm or explain? Thanks!

 

{% if first_time_accessed %}
  // Conversion scripts you want to run only once
{% endif %}

  // Scripts you want to run on every visit
if(typeof fbq === 'undefined') {
}

 

CedCommerceAman
Shopify Expert
9 0 1

Go through this link: https://leoebbert.com/how-to-fix-a-double-counting-facebook-pixel-in-shopify/

Hope you find it helpful.

 

Regards,

Shopify Expert
neha18
Visitor
3 0 0

hi aman, If its okay - could you please tell me if my pixels are firing twice. I have two fb pixels installed on my website. Are each of them firing twice for purchase events? My website is isadoralife.com

Arpan12
Shopify Expert
54 2 9

Hey DenisG0,

 

Would you mind sharing your store URL? It would be easier to grab the issue then.

Thanks!

Arpan Srivastava
Store Analyst

Skype id-live:danbakker_2

Want to Increase your Sales on Shopify?
Now do connect with me on group also https://www.facebook.com/groups/Shopifysellershub/

Shopify Expert
DenisG0
Tourist
8 1 3

Hi Arpan,

 

This is the order confirmation page i was using. https://cuddleandkind.com/3083763824/checkouts/4d090060c2203c73ae8f37dc93b3d4bd/thank_you
I have switched back to shopifys native integration as the double reporting was messing with my ROAS. 
Like i said, there were no issues with other events except the purchase event found on order confirmation page. 
Perhaps the tag "first_time_accessed" is simply not working?

DenisG0
Tourist
8 1 3

This is an accepted solution.

What finally resolved this double activation was checking for the instance of fbq. 
So inside the first_time_accessed, having an additional conditional check:

if(typeof fbq === 'undefined') {
}

Thank you to all that responded and tried to help. 

Arpan12
Shopify Expert
54 2 9

Hi @DenisG0 

 

I have again checked, your add to cart event on facebook is occurring twice, it needs to be corrected.

 

Regards

 

Arpan Srivastava
Store Analyst

Skype id-live:danbakker_2

Want to Increase your Sales on Shopify?
Now do connect with me on group also https://www.facebook.com/groups/Shopifysellershub/

Shopify Expert
DenisG0
Tourist
8 1 3

Thanks for pointing that out. Currently the store is using Shopifys native pixel integration so that is troubling to hear. 

Shafaq_Munir
Visitor
1 0 0
Please why is that so and where i have to paste this code to avoid this problem purchase event is firing twice
vihek
Visitor
3 0 0

Hi i am facing the same issue it been a month and this error is messing up with my results. my every facebook campaign is showing double purchases events. how can i solve this ? its urgent  

vihek
Visitor
3 0 0

Please Help me Out & im struggling with same. its been 2 months now 

yvitaly
Visitor
2 0 0

Same problem here... Using the Conversion API makes every purchase event fired twice... Don't know what to do... Anyone solved this?

Megaphone_Marke
Shopify Partner
4 0 1

Hi, I am having a similar issue.

 

Used the native shopify Facebook app to connect the pixel.

My issue is that the purchase event pixel fires everywhere - even when I visit the page. Can someone help, please?

The website is indosoleeurope.com (need to use a VPN for europe)

Pod11
Visitor
1 0 0

Hi @DenisG0 I noticed your order page isn't sending Purchase events. That's exactly what I'm trying to fix on my site. My question to you, are you still using the Native Integration method for FB pixel?

neha18
Visitor
3 0 0

hi arpan, i think my fb pixels are firing twice. I have two fb pixels and i think each of them are firing multiple times for a single event. Can you pls guide - isadoralife.com

QashU
Excursionist
16 2 39

This happens when you pixel tracking is not on point, and in my opinion as a digital marketers, tracking your data in the core core responsibility.

So i suggest everyone to please put your focus on your tracking, how are you tracking your data and how are you segmenting it, because if you have a lot of data and you did not segmented it very well means you are not utilising the data,

For that i would suggest you guys WinAds.

 

This app helps me always with on point Tracking and catalog setup.

 

PLUS PLUS

 

they give you hyper event, means normal facebook pixel gives your Viewcontent, Add to Cart, IC, Purchase.
But that app make you Pixel boost up with a-lot of other hyper event,

Like:

PageScroll,

Time Spent,

Showed Interest,

Customer Tagging,

High Spender,

Abandon Cart,

Still Thinking,

Prospect.

And all these events have login behind them, for example showed interest is like when some one view your product then change the varients of your product.

Thanks 🙂

 
Qash
Era Of Ecom
Dept Head Media Buying
https://eraofecom.org/
NoumanAsif
Visitor
2 0 6

Yes, I agree with you, Qash. I am also using that app, hyper events give me so many new lookalikes, and new lookalike means new audience to target, and new audience means Scaling which I love to do.