hi guys
How can i can the event tag to a button click? i cannot find this info anywhere (without using Google tag manager)
I am trying to make a button click an EVENT CONVERSION (LEAD) so i know people are interested in the product.
isn't there a way to fire the EVENT TAG on a button click, prior to it going to the link of the button?
If you are using jQuery
$( "#buttonId" ).on( "click", function() {
console.log( "the button was clicked" ); // <= put a JS here that trigger your tag
});
More info: https://api.jquery.com/on/
If you are not using jQuery
You can call a JS function that will trigger your tag
<button onclick="myFunction()">Click me</button>
More info: https://www.w3schools.com/jsref/event_onclick.asp