Facebook Pixel: Purchase Event firing Twice

Solved
Tourist
8 1 0

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. 

0 Likes
Highlighted

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
0 Likes
Tourist
8 1 0

 

{% 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. 

 

0 Likes
Tourist
8 1 0

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?

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

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/
0 Likes
Tourist
8 1 0

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?

0 Likes

Success.

Tourist
8 1 0

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. 

0 Likes

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/
0 Likes
Tourist
8 1 0

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

0 Likes