Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Facebook support says that your website is triggering 2 events at a time that duplicates the orders on their channel. So events are being triggered with Facebook Pixel as well as Conversion API. And unfortunately, both are getting registered as sales. Whereas we aren't doing those numbers that are being falsely represented due to duplication.
Hi! Have you figured it out? I see on our Facebook Ads that we too do not meet the "best practices" for the event deduplication. But the instructions from Facebook are very vague and in the direction of "ask your developer to change the code". What code? And we do not have a developer...
Have you found a solution to this?
It looks like my script worked. Now, the event matching quality is marked as good which is fine by me.
Here is the code I inserted in the Settings -> Checkout -> Order Status Page:
<!-- Facebook Pixel Code to track order variable-->
{% 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','https://connect.facebook.net/en_US/fbevents.js');
// Insert Your Facebook Pixel ID below.
fbq('init', 'INSERT-YOUR-PIXEL-HERE');
fbq('track', 'Purchase',{value: {{ order.total_price | money_without_currency }}, currency:'CAD'},{eventID: '{{order.order_number}}'});
</script>
<!-- Insert Your Facebook Pixel ID BELOW. -->
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=INSERT-YOUR-PIXEL-HERE&ev=Purchase&noscript=1"/>
</noscript>
{% endif %}
<!-- End Facebook Pixel Code -->