0

basically I need to add this

fbq('track', 'Lead');

to a button. The button doesn't lead to a page so I can't do page views.

I can't figure out how to specific a button. I see page clicks but I don't see how to specific a specific button by id or something like that.

Is there a place to add custom javascript? I could just add it the the button using javascript.

  • Is it actually a button (<button></button>)? And what exactly is it you are wanting to do, fire an event when it is clicked? If so, you can just add a class to the button and select 'Click Element' in Tag Manager and get it to match a CSS selector. Would that not do what you need? – zigojacko Feb 28 '18 at 10:08
2

You can add custom JavaScript within a script element in a ‘Custom HTML Tag’.

  1. Add a new tag and choose Custom HTML from the Custom section.

  2. Add a <script> element to the tag, with whatever JavaScript you would like inside.

  3. Choose a trigger of at least DOM Ready, as the elements on the page need to be ready before your code is run when you're trying to select an element on the page.

Your finished tag should look something like this:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.