The appearance of the Google Tag Manager (GTM) tool simplified many aspects of the implementation of tracking tags on a web. In addition to centralizing all of them in a single space, the possibility of introducing changes to the web code without relying on the IT department has been a great step forward for marketing managers and technicians (It’s over asking a programmer to implement the Analytics code!).
But the GTM functionalities go beyond the activation of web analytics tool labels. One of the possibilities it offers us is the ability to modify the HTML code of a website in which the GTM tag has been incorporated. And why would we want to do this? We tell you below.
“With Google Tag Manager we can modify practically any HTML element.”
Why modify HTML elements with Google Tag Manager?
Before inquiring into the reasons and opportunities offered by this functionality of GTM, it should be noted that by modifying the HTML code of a website we open a new range of potential errors in it. Either because of the ignorance of the person who applies the changes with GTM or because of the lack of coordination with the programming department.
Therefore, before applying this type of actions, we should at least notify the IT manager of our intentions, in addition to validating the changes once applied.
Some of the main reasons to modify HTML elements with Google Tag Manager are:
- Independence of the programming department.
- Immediate application of the changes.
- The possibility of testing and version control.
- Ease of use for non-programmers.
- Most common cases resolved.
What HTML changes can we apply with Google Tag Manager?
Some of the most common cases for which we will use GTM in HTML insertion are:
- Tracking codes and associated events.
- Insertion of data marking with Schema.
- HTML tags linked to SEO (canonical, robots, hreflang …).
- Modification of the visual section of a web through CSS styles.
- Incorporation of own scripts.
In short, we can get to add, modify or delete virtually any HTML code.
How to change HTML elements with Google Tag Manager?
After having incorporated the GTM container and the initial configuration, we can introduce changes in the HTML of a web in a few steps:
- Define or configure the necessary Variables.
- Choose the right Trigger / Activator (all pages, only in particular, when the user clicks on a specific element, etc.).
- Create the Tag / Tag of the custom HTML type with our code.
- Test and implement the changes.
A practical example: we want to implement the tag “meta robots” with the noindex value to avoid that the pages with filters in the URL of our online store are indexed in Google. For this we should:
- Define a Trigger / Activator that only acts on the pages that contain the filter in its URL. We can use the type “Page view” and check the option “Some page views” indicating that the URL contains the parameter in question.
- Create the Tag / Tag of custom HTML type with the corresponding tag and associate it with the Trigger / Activator that we have created before.
- Test and upload the changes.
And at the SEO level, will Google bots be able to process these changes?
Anyway, whenever we can, we should validate if our implementation is applied correctly, both for tracking bots, and for the user.
As you can see, Google Tag Manager allows us to introduce all kinds of changes in the HTML code of a website, with the advantages (and risks) that it entails. If you need help with the implementation of GTM or any other aspect of web analytics, do not hesitate to contact us.