Niko
Niko

Reputation: 51

Track sign-ups with facebook pixel on click (JS/JQUERY code)

I'm trying to track sign-ups on website, I've installed the Facebook pixel by putting it in the head section.

I want to fire:

fbq('track', 'Lead');

When someone clicks the button (which is an input element with the ID "#es_txt_button_pg")

I've added this script to my website:

$("#es_txt_button_pg").click(fbq('track', 'Lead'));

Should this code work?

Upvotes: 2

Views: 1715

Answers (1)

iwein
iwein

Reputation: 26161

You should pass a function to the click. E.g.

$("#es_txt_button_pg").click(function(){fbq('track', 'Lead');});

Upvotes: 2

Related Questions