Click tracking with google analytics + tag manager.
Connecting google analytics with tag manager will afford specific and customised tracking. A prime example of this being a need to track how many times students interact with a unique element, such as when clicking a button or dragging an object.
Containers in tag manager
A collection of tags “things we are tracking” is called a container. A container can replace all other manually coded tags on a website (or app). We can simply attach the container to our site, then use this container to track whatever we want. We define what goes into the container (i.e., what we want to track).
This method works particularly well for tracking interactions with defined items on our site (buttons, sliders, nav menus etc).
We can track anything that we can reference as a unique element. The easiest method for this referencing is to use ID values on our web elements, e.g:
<button id = ”track-me”>
- Containers – as defined above
- Properties – these are your websites, apps etc that you are adding analytics to
- Tag – a bit of code attached to websites/apps, that lets you run analytics
- Google Analytics accounts contain Properties(which contain Views)
- Google Tag Manager accounts contain Containers.
It’s recommended to use one account per client/company and have separate containers for company’s/client’s Mobile Apps, Websites, etc.
From the tag manager main screen, you can see a list of tag manager accounts for which you have access, and the containers within each account:
Create or open an existing account (generally, one account per organisation is enough)
Then create or open a container. If this is the first time creating your container, you will be given some code that needs to be added to your web content. Follow the instructions to attach the container to your web content.
With tag manager connected to our web content, we can set up our custom tracking. We want to track click-related events so the first thing we need to do is to enable default variables for clicks. Under the “Variables” tab, press “Configure” then enable all click-related variables:
Now we can create our trigger. Under the “Triggers” tab, create a trigger that fires on all clicks on all elements:
You can now preview your site to see click tracking in action. Press the preview button then enter the URL of your web content that contains the container code from earlier. This causes a new window to open with your web content. Clicking on your web content should now trigger an event to fire in your tag assistant window:
With everything working, we can now use the “Triggers” tab again to set up triggers for any element with a specified ID, e.g:
Plenty more to explore, e.g:
- Tag firing schedules can be used to undertake analytics with a defined timeframe.
More general info:
Glossary of terms: