: 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
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.
More posts by @Berryessa370
1 Comments
Sorted by latest first Latest Oldest Best
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:
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.