Facebook verification pixel code problem

Hi,

I have a problem pasting the facebook verification pixel into the head tag. Any ideas?

“Line 15 column 67: Unexpected start tag token (img) in the frameset phase. Ignored.
Line 15 column 182: Unexpected end tag (noscript). Ignored.”

Hi @bennyhagen, the issue is that our custom code parser does not like the noscript tag. Can you paste the noscript part of the code here for me, and I can give you some alternate code that does same thing as that tag so that you can save that to your page.

Cheers, Dave

Great, thanks! Here’s the code:

<!-- Facebook Conversion Code for Benvisual Design -->
<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;
  }
})();
window._fbq = window._fbq || [];
window._fbq.push(['track', '6021680802311', {'value':'1.00','currency':'HUF'}]);
</script>
<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=6021680802311&amp;cd[value]=1.00&amp;cd[currency]=HUF&amp;noscript=1" /></noscript>

Hi @bennyhagen, Thanks for that :slight_smile: In the HEAD of your site, put the first part of the code as before:

<!-- Facebook Conversion Code for Benvisual Design -->
<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;
  }
})();
window._fbq = window._fbq || [];
window._fbq.push(['track', '6021680802311', {'value':'1.00','currency':'HUF'}]);
</script>

Next, paste in the following code:

<script language="JavaScript">
<!--
document.writeln("<noscript><img height=\"1\" width=\"1\" alt=\"\" style=\"display:none\" src=\"https://www.facebook.com/tr?ev=6021680802311&amp;cd[value]=1.00&amp;cd[currency]=HUF&amp;noscript=1\" /></noscript>");
//-->
</script>

Then save changes and republish your site. Try that and see how it works ! I hope that helps.

Cheers, Dave

Worked like a charm! Thanks so much for the lightspeed help!

Oh noes…

Initially Facebook accepts the script but then sais:

“Your ad is currently not optimized for conversions because your conversion-tracking pixel isn’t working correctly. Check your conversion-tracking pixel and refresh, or try verifying the pixel again.”

Any ideas?

Hi @bennyhagen, can you send me a link to the published site?

Cheers, Dave

Hi @cyberdave
Apparently there just was some hickup, it seems to work now! Thanks again!

1 Like

hi @cyberdave

If I am having the same issue do I just use the 2nd sample code but replace the variable of
6021680802311

which is benny’s unique ID # I’m guessing, and I will just put my # in… although mine looks a bit different ;(

I’ve changed my clients unique fb ID vairable to 123456789 for the instance above.

thanks Dave

Hi @LvnLife, sorry for the late reply. You could probably just change the code and test it out. If it does not work, then probably that code have to be updated like the code in @bennyhagen’s case. Let me know how it goes, I am here to help out also :slight_smile: Cheers, Dave

Thanks! This solution has also worked for me!

1 Like

Hi Cyberdave

I’ve tried the above without joy.

Please can you assist?

I still have some error message…

I tried to paste the code here but it would not show…

Ive pasted the extra section in also? Im sure this is not the right thing to do?

<!-- 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', '892806977479904');
fbq('track', "PageView");</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=892806977479904&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->
<script language="JavaScript">
<!--
document.writeln("<noscript><img height=\"1\" width=\"1\" alt=\"\" style=\"display:none\" src=\"https://www.facebook.com/tr?ev=892806977479904&amp;cd[value]=1.00&amp;cd[currency]=HUF&amp;noscript=1\" /></noscript>");
//-->
</script>

Error messages received:

Line 11 column 3: Named entity expected. Got none.
Line 11 column 3: Named entity expected. Got none.
Line 11 column 3: Unexpected start tag token (img) in the frameset phase. Ignored.
Line 12 column 12: Unexpected end tag (noscript). Ignored.

Hi Kennith ! I am very sorry for the late reply !

Could you paste the original facebook conversion code you received ?

It looks like some tag is off somewhere so the javascript is not valid. I would need to see the original code, and I can help further :slight_smile:

I’m getting the same errors on line 11.

Here is the facebook pixel code:

<!-- 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', '733928086751111');
fbq('track', "PageView");</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=733928086751111&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->

I placed the code in the individual page head, and was able to save. Would be nice to save it in the custom code panel within the site settings.

Hi @gksargent, just remove the noscript tag altogether from the code, then save.

Could you try that and let me know if any issues?

Regards,
Dave

Hi @Kennith_de_Kock, man I am sorry I missed your post ! Remove the noscript tag from the code, and then it should work.

Regards,
Dave

That appears to have worked! I’m assuming I’m not losing anything important since that part of the code is just hiding the pixel? What is that portion of the code doing I wonder?

Hi @gksargent, that piece of the code tells the browser, “if javascript is not supported on the device that the site is being viewed, then use the html in the noscript tag instead”.

I hope this helps !

Perfect, thank you. :smile: