Add Facebook Pixel Event Tracking to Button

Hello! I know there are several other threads on this topic and resources available from both Webflow and Facebook, but I’ve been working on this for several hours without any luck. Any help would be much appreciated - thank you!

Share Link
Published Page

I’ve been following instructions from this Webflow article to implement event tracking on button click.

I’ve added the following snippet to the head and body custom-code sections of the relevant page: <script type="text/javascript"> document.getElementById(trackbutton).addEventListener('click', function() { fbq('track', 'Purchase'); }, false); </script>

I’ve also added the ID '“trackbutton” to my desired button, which is the “contact us” accordion button at the very bottom of the page.

Facebook pixel helper detects the event code but does not register that it is activated when the button is pressed. Error message:

We detected event code but the pixel has not activated for this event, so no information was sent to Facebook. This could be due to an error in the code, but could also occur if the pixel fires on a dynamic event such as a button click.

You’ve got an error in your custom JavaScript. Try changing trackbutton to 'trackbutton'. Please note I added quotation marks around trackbutton. I can’t say that will make your pixel event start working, but it certainly has a problem the way it’s currently written.

1 Like