Facebook Conversion Pixel code: BODY vs HEAD
facebook, html, tracking
Solution
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.
Problem
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> ```