Click event for Google Tag Manager

Sometimes you need to add tracking for Google Tag manager manually.  

Here is a snippet of code that will active the events for Google Tag Manager, and allow you see successful click events. 

Useful for call to action for signing up to a newsletter, views on a video, anything really that involves you clicking a button.

Google Tag manger tracking clicks

Below is a button with an id of “mybutton” this will listening for a click event to run the code for the Google Tag Manager.

I am using Elementor, so my code for the button is a bit longer than normal, but the id can be set visually.

Below is the javaScript to active the Tag manager code. Window.datalayer is you tag manager code that you have created yourself and add your own push descriptions.

If you what to learn more on basic javaScript, here are some good books below to get you started.

Add a Comment

Your email address will not be published. Required fields are marked *