Exchange Tower Level 1, 530 Little Collins St Melbourne VIC 3000
03 70024120

Using Google’s Tag Manager for A Better SEO

There are certain technical changes in SEO that cannot be directly made to a website. Quite a number of reasons are responsible for this, the most common being the presence of rigid CMSs. Developmental queues is another cause that might pose as a hindrance in the process of implementing SEO changes.

This makes it necessary to explore alternatives and ensure that the changes are successfully implemented. After all, merely figuring out the changes that are required to enhance the performance of a website will not help. If the alternations cannot be made in the first place, the entire strategy will fail.

Some form of meta-CMS can be used as an alternative. This technique involves the existence of a system besides the existing CMS and gives you the chance to make particular changes to your page, bypassing the limitations posed by the CMS. This method also allows you to test the SEO changes made on the pages.

For websites that cannot use meta-CMS, there is another alternative technique that can be used. It is a system of tag management. The most commonly used tag manager is the Google tag manager and in this blog, we will use it as a reference. Tag managers make use of one JavaScript container tag that allows the addition of various other tags to the webpages. The advantage of using this system is that it makes it possible to make alterations to the tags without making any change to the pages. The alterations can be applied to the tags in the container and they can be made on the pages.

Tag managers can widely be used to apply off-the-shelf tags including Facebook tracking and Google Analytics. Another functionality that is not very popular is the custom HTML snippets. With this, you can make amendments on the HTML of pages based on certain defined rules. An advantage of using tag manager is the fact that it allows you to make changes to a page with a single tag.

It makes it possible to override the CMS restrictions along with the developmental queues and make changes to on-page content, canonical tags and page titles.

Since tag managers make use of JavaScript to apply tags, they were not considered as a trustable method to apply SEO changes. The earlier thinking was based on the concept that when it comes to implementing SEO changes, Google cannot reliably implement JavaScript and any changes applied with JavaScript would be disregarded. However, there is evidence that indicates that changes are being recognised by Google. These include the ones implemented with tag manager.

Ways to make HTML changes with GTM:

The changes that can be made involve adding new components to pages, altering the content or features of elements or getting rid of certain elements from a page. To make any of the above-mentioned changes you will require an understanding of the following:

  • CSS Selectors and HTML: They will enable you to understand the elements of the page that require changes or from which data can be gathered.
  • JavaScript: This allows adding elements to pages.

There are some very simple elements that can be added to a page without the need to extract anything from the existing page. However, there are many other changes that are much more complex. These may cover product structured data to e-commerce sites that require data extraction from the pages.

Adding elements:

To add an element to an HTML page, custom HTML tag from the GTM can be used. This can be done with or without the iQuery. In GTM, most of the tags are linked to a trigger which indicates to the container the tag that needs to be implemented. For changes that you require Google to mark, the tags will trigger when pages load. Any of the variables can be used to decide the pages on which the tag will load on.

Methods to extract data from a page:

Data from any page can be extracted by using two approaches. The inbuilt variables of GTM can be employed and enable you to draw out the text or a component of any element. You can also do this with the help of JavaScript or iQuery in the HTML tag.

For SEO changes, locations that you will most likely prefer to draw data will be by building an organised data markup with the help of JSON-LD. To add clarity to this method, we will look at an example that involves building a product markup through extracting elements in GTM variables along with the HTML tag.

To elaborate this particular example, we will assume a website that has product pages that include data about the product and has unique IDs in the HTML section of the page. You will require determining CSS selectors which exactly yield the elements that you are looking for. An immensely useful tool that can be employed for this purpose includes Selector Gadget Chrome Extension which enables you to locate distinctive CSS selector for various elements within a page.

If you happen to use the GTM variables for extracting data from a page, it is necessary to have a variable to cover the different elements. This can be done by moving to Variables menu and selecting on ‘NEW’ under the section ‘User-Defined Variables’.

For the elements, you will need to define a ‘DOM Element’-type variable with the help of a CSS selector or ID. For the various elements, you can have the ‘Attribute Name’ section blank. However, for the image, you can draw the src element. You also require having an HTML custom tag to extract data to JSON markup.

Element ID Associated Schema Data
Product_name  name
product_image image
price_value price
proce_currency price_Currency
ratings_Count review_Count
avg_rating rating Value


The above method can be used without employing the GTM variable and by just applying one HTML tag. For this, we require making use of iQuery to serve the same purpose as that of the GTM variables.

Making use of iQuery:

There are a number of advantages associated with the use of this particular method. If you choose to employ it, you will not require having individual variables. All the required information is present in one tag. However, if there are variables that are being recognised by various tags, any change will be implemented to all triggers and tags and it is not necessary to change individual ones.

Is this method effective?

It is necessary to ensure that Google actually recognizes the alternations that are applied by GTM. There is some amount of uncertainty though if Google will index markup along with the content that is implemented with the help of JavaScript. However, there are quite a few instances that indicate that changes made by GTM are immediately recognized by Google.

JSON-LD for your structured data markup:

Both iQuery and the variable method yield valuable results in search in situations where there was no organised data at all on the page.

Rich Snipet

Canonical Tags:

There is also evidence that reflects that Google pays emphasis to canonical tags that have been implemented with GTM.

Canonical tags

Mobile Sub-domains and Switchboard tags:

Certain examples indicate that after mobile switchboard tags are applied on desktop sites using GTM, the pages that are on mobile sub-domains began to be indexed.

Steps to implement tags in sites with iQuery:

  • The container from the Google Drive has to be downloaded
  • In the ‘Admin’ section of GTM container that you wish to import within, select the option ‘Import Container’
  • Next you need to move to the download location. In this section you need to select the container file. Select the option ‘merge’ and ‘rename’ any tags that is conflicting
  • Click the ‘Confirm’ option
  • After the container loads you can make the necessary changes to the tags to ensure that they are relevant to your site. You can allocate triggers to only the pages which are suitable.

Mobile Switchboard Tags:

If there are separate mobile sites with similar URL structure, then switch tags can be added to replace ‘www’ with ‘m’ in the domain names. The canonical tag will also be added to the mobile pages directing to their desktop equivalents.

Adding a no index tag:

While using this tag, you need to be extremely careful to ensure that you do not end up using it on every page of your site. You might want to use this tag for particular products page that has products that are not available. Triggers can be used to detect products that are not available and add the no index tag.

Tags for self referencing canonical:

This adds canonical tags to pages that point to themselves. If the pages have a URL parameter, that points to the parameterless edition of the page. However, you need to take care for pages which are meant to canonical other pages as this might overwrite prevailing canonical tags.

Tags for bread crumb structured data:

The tag uses bread crumb components that have a CSS selector. It then writes them on JSON-LD.

Tags to add structured data for products:

In this case, the IDs in the selectors of particular elements are replaced to include the data.

The above techniques can be successfully implemented to make changes using Google’s tag manager.


Leave a reply