Mobile app version of vmapp.org
Login or Join
Berryessa370

: How to add an onclick event to a specific button Google Tag Manager 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

@Berryessa370

Posted in: #GoogleAnalytics #GoogleTagManager

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.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Berryessa370

1 Comments

Sorted by latest first Latest Oldest Best

 

@Connie744

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


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


Add a <script> element to the tag, with whatever JavaScript you would like inside.
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:

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme