Reputation: 13
I have installed the new Facebook Pixel in my website. But I get strange, inconsistant results:
So basically, something is messed up in my Facebook script that makes my pixel return results that do not correspond to reality. Would someone have an idea of the reason for this problem? Many thanks in advance.
My store is running Magento CE 1.9.0.1 and here is the Facebook-generated pixel code I have copied in app/design/frontend/shopper/default/template/page/html/head.phtml
:
<!-- Facebook Pixel Code -->
<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');
fbq('init', '119809338361519');
fbq('track', "PageView");
fbq('track', 'ViewContent');
fbq('track', 'AddToCart');
fbq('track', 'InitiateCheckout');
fbq('track', 'Purchase', {value: '0.00', currency: 'EUR'});
fbq('track', 'CompleteRegistration');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=119809338361519&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->
Upvotes: 0
Views: 1464
Reputation: 87
If you have adBlock running on your site, disable it.
Hope this helps someone
Upvotes: 0
Reputation: 1
I was facing the similar issue. With these changes I resolved the issue:
<head>
!-- Facebook Pixel Code -->
....
....
....
<!-- End Facebook Pixel Code -->
</head>
<script>
fbq('track', 'ViewContent');
fbq('track', 'AddToCart');
fbq('track', 'InitiateCheckout');
fbq('track', 'Purchase', {value: '0.00', currency: 'EUR'});
fbq('track', 'CompleteRegistration');
</script>
Summary: View the source code of the page. Ideally facebook pixel code (as provided by facebook) should be within tags. Whereas tracking code should be outside it. Hence i have copied the tracking code directly into the body of respective page. After this I am no more getting the error.
Upvotes: 0