The onclick event executes a certain functionality when for example a button is clicked. This could be when a user submits a form, or a click on a phone number, and much more.
This event will let the users monitor and track the number of clicks on each button or link and use this data to improve the browsing experience for your website visitors.
How to set up a event
First step, the user should do is to make sure that the deployment of our script is already made on the Tag Manager os that the statistics are ready to collect data.
https://help.monsido.com/en/articles/5556032-google-tag-manager-monsido-deployment
The event is set on with Javascript so the next step it will be the creation of a new tag, and the type should be Custom Tag.
selection of the tag | Custom tag (HTML) |
---|---|
The tag configuration will popup on a side window and the user should make sure to configure it properly.
First, rename the tag. That option is on the left top corner of the window
Second, that is the most important field because you will to add the event onclick script.
<a class="b-btn-t" href="#">Click me</a> <script type="text/javascript"> function trackEvent() { return window.monsido_functions.trackEvent('Category', 'Action', 'Event', 1); } document.querySelector('a.b-btn-t').addEventListener("click", trackEvent); </script>
Note: Make sure to adjust the script since this is set to trigger on a specific button
Third, you can select the tag to be trigger on one or several pages and for that the user might need to adjust the trigger configuration - https://support.google.com/tagmanager/answer/7679316?hl=en
After all steps completed, the user just need to save and publish the changes.
Attachments:
Screenshot at Jan 24 10-25-24.png (image/png)
Screenshot at Jan 24 10-32-55.png (image/png)