Facebook Pixel


I'm trying to add the Facebook Pixel to our Knack database as we will be running some FB Ads that lead to a Knack page. But every time I save the JavaScript code, the site goes down (none of the content loads, but there's no error message - just a blank page).

Does anyone know if there's a fix for this?

Normally I would use a proper landing page, but that's not an option in this case.


OMG, 369481659772 you are my new favourite person! I can't believe I didn't figure that out. Thank you soooo much for your help! It is GREATLY appreciated.

Its not loading because you are adding script tags in the javascript you just need to make some small changes to your facebook pixel code to make it work. Add the code like this https://www.knack.com/developer-documentation/#how-to-add-custom-code

Then modify your Facebook pixel code so it doesn't have the script tags and no script tags so remove all these elements from your facebook pixel code


<noscript><img height="1" width="1" style="display:none"

You will be left with something like this:

<!-- Facebook Pixel Code -->

s.parentNode.insertBefore(t,s)}(window, document,'script',
fbq('init', 'XXXXXXXXXXXX');
fbq('track', 'PageView');

You are removing these tags because you are already inside of a <script> tag and <noscript> is not needed anymore.


I'm still struggling with this, and I'm wondering if loading the JavaScript externally would solve the issue:


I'm not all that great with JavaScript, so I'm not 100% sure I can make this work. Does anyone know if this would be worth pursuing? I'd hate to go down this path only to learn it was never even possible to begin with.