Tagged: event listener
I’d like to add an event listener so I can set up trackEvents on a call button on my site. I will be using Google Tag Manager. How can I add an Event Listener or a click Event to the Avia buttons?
http://www.familycourtdirect.com
Thanks for your help
Hi MagneticBloom!
You would need to copy the raw html that gets generated and then re-build the button with whatever attached code as plain html.
Regards,
Devin
Hi MagneticBloom!
I had the same problem, I couldn’t track the click on the Form button with GTM. It is because the theme already uses a listener.
I managed to fix it, I hope it will be help you to do it as well.
You have to add a simple code in the javascript file called “shortcodes.js” (\wp-content\themes\enfold\js)
The code you have to add is
return dataLayer.push({'event': 'FormSent'});
just after the line :
form.slideUp(400, function(){responseContainer.slideDown(400, function(){ $('body').trigger('av_resize_finished'); }); send.formElements.val('');});
. I think is line 2352.
Once you made it, you have to create a Tag in Google Tag Manager (your event categoy, action, labels…) and set up a rule.
To make the tag fired, the rule has to be like that:
{{event}} equal FormSent
I hope it will work for you.
Cheers
Pascal
Hi!
Thanks for sharing your solution Pascal.
Cheers!
Josue