Can I place the Facebook Conversion Pixel inside the BODY (as opposed to inside the HEAD, which is what Facebook suggest in their specs?
I don't see why not. Has anybody tried it?
Here is an example of the code
<script type="text/javascript"> var fb_param = {}; fb_param.pixel_id = '123456789'; fb_param.value = '10'; fb_param.currency = 'USD'; (function(){ var fpw = document.createElement('script'); fpw.async = true; fpw.src = '//connect.facebook.net/en_US/fp.js'; var ref = document.getElementsByTagName('script')[0]; ref.parentNode.insertBefore(fpw, ref); })(); </script> <noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/offsite_event.php?id=1234566&value=10&currency=USD" /></noscript>
It works in the BODY.
Go to Settings → Insert Headers and Footers. Paste the Facebook Pixel tracking code into the Scripts in Header box. Save your changes.
Log into Facebook in a web browser on your laptop or desktop. 'Create Pixel' screen will appear if you have not already done so. Pixel code will be in upper right corner if you have created one.
The Facebook pixel is a piece of code that you place on your website. It collects data that helps you track conversions from Facebook ads, optimize ads, build targeted audiences for future ads and remarket to people who have already taken some kind of action on your website.
According to this answer here: https://www.facebook.com/help/community/question/?id=10200354561858276
you can place it inside the <BODY>
element but FB recommends to keep it at the beginning of <BODY>
or in the <HEAD>
as the conversion will be then counted even if the page does not load fully or the user closes the page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With