Google Tag Manager - is a tag management system that allows you to quickly and easily update measurement codes and related code fragments collectively known as tags on your website or mobile app. Once the small segment of Tag Manager code has been added to your project, you can safely and easily deploy analytics and measurement tag configurations from a web-based user interface.
It is used for web analytics and allows you to manage the tags with no extra help.
In our case it helps to transfer the data to any analytical system and launch retargeting campaigns.
A trigger is obligatory so that the tag worked properly. The trigger could be set up to activate the tag as well as block and stop its functioning.
The trigger could have the following events: URL download (complete/ incomplete download), on click event.
You may limit the trigger function on the particular pages. If you want to track a particular page mysite.com/order there is an option to set up a trigger to “the page view” with Page URL macros with the meaning mysite.com/order. Now we may get the data on visitors actions on this website watching the product views, transactions, conversions. etc.
First thing you need is to set up GTM - container
*on every page
*the higher you place the code to the tag the quicker it works
Dashboard > Edit campaign > Conversion sensors
To place a code at the client’s page a simple action should be performed.
All Pages - is on the list of triggers by default. It’s enough for our system to fire a conversion sensor.
Trigger All Pages means that GTM container launches the script which is incripted into the tag as soon as the user visits any page where container is placed.
Let’s move to onclick event settings up.
Step 1. Create a new trigger (condition)
Step 2. If you need to set up a trigger on one item (the button), which should be clicked on, this trigger must be assigned with an ID of an element.
Step 3. If you want to set up a trigger on a couple of elements, the trigger should be assigned to a class of elements. This class should be assigned to all the elements needed.
Click id is oriented on reading tags IDs.
Click ID. Gets access to the data and reads the key gtm.elementId, which is set by click triggers. As a result, there’s an ID attribute in the DOM element which was clicked on.
When creating the tag, don’t forget to add <script> for the code to fire.
We set created trigger, name it, and save it.
<script> onclick = '_mgq.push(["MgSensorInvoke", "event goal"])' </script>
*If you want to place an event right afrer the code is downloaded, just make an announcement before _mgq.push
var _mgq = _mgq || ; _mgq.push(["MgSensorInvoke", "event goal"])
Thise kind of code could be alined with GTM
Don’t forget to put it in <script> </script>
<script> var _mgq = _mgq || ; _mgq.push(["MgSensorInvoke", "event goal"]) </script>
Checking on the clients’ side
Using F12 for Chrome и Firefox or Alt+Command+J for macOS, we call for an inspection of a page
Then we get to Network section
There is client’s GTM on the list
If GMT worked out correctly our sensor shows it.
Status = 200 (Response code of a successful status)
When clicking on the button, the same result should be depicted.
On this particular case there was three-time clicking on the button on the website.
So now we see three results here.
To check how exectly our code is written in GTM container, you may look cklicking here.
You will see this kind of information.
Now you’re all set.