Search code examples
javascriptfacebooknoscript

Facebook ad tracking without noscript portion


The facebook implementation for the custom audience pixel is written in this form:

<script>(function() {
  var _fbq = window._fbq || (window._fbq = []);
  if (!_fbq.loaded) {
    var fbds = document.createElement('script');
    fbds.async = true;
    fbds.src = '//connect.facebook.net/en_US/fbds.js';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(fbds, s);
    _fbq.loaded = true;
  }
  _fbq.push(['addPixelId', '###########']);
})();
window._fbq = window._fbq || [];
window._fbq.push(['track', 'PixelInitialized', {}]);
</script>
<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?id=###########&amp;ev=PixelInitialized" /></noscript>

We want to deploy this using a tag manager but ours only supports javascript only not HTML. I'm wondering how important the noscript portion of this is? Would the only drawback be that we would be just losing a certain portion of our audience, namely those on devices that do not support javascript or those who disabled javascript themselves?


Solution

  • The noscript portion is a fallback, yes. But if you can't add it with a tag manager, why not simply place the img tag <img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?id=###########&amp;ev=PixelInitialized" /> on the page somewhere, e.g. just at the bottom of the body tag.