More often than not, optimizing a website for search means adding tags, markup, or other elements that are not user-facing to our sites. Although a developer is usually required for complex changes, Google Tag Manager gives us the ability to grab and insert simple data onto any page with our published container.
For example, GTM gives us the ability to place structured data markup onto a page without editing our site's original files. It's simple—we inject a body of code into the HTML through GTM's Custom HTML tag. It’s just a body of code that is added onto every page as it's triggered; nothing on the front end should be affected by this change. But, do we really know if and how injected data is being respected by Google?
In the case of structured markup, we often inject this data without the expectation of an immediately observable outcome; structured markup is meant to relay additional information about the context of a page or business to Google. So, I’d say whether this information is respected by Google depends on the situation. Information such as LocalBusiness markup may be respected in the sense that Google crawls it and therefore has the expanded context we intended on passing along. However, Google may not “respect” BreadcrumbList markup (show an enhanced breadcrumb list in SERPs) if you inject this data but there is no actual breadcrumb navigation visible to users on your site.
I ran a 2-month long test to see which types of injected data are respected by Google and which are not. I tested a few, specific types of injected data that would allow me to make conclusions based off whether or not I saw changes in SERPs. These included:
Meta Page Titles: Not Respected
Experiment details: - There were tags hard-coded in the header - The text in this tag appeared most often in SERPs - There were no meta page title tags specified on any of these pages
In March, I injected meta page titles onto every page that pulled the H1 and inserted it into where it says “Example Title".
A few weeks later, I checked the appearance of these pages in SERPs and it was a no-go. The page titles that were injected were not recognized by Google and applied to search results. In some cases, Google made up its own page title for our pages that were nowhere to be found in the page source or DOM.
Canonical Tags: Respected
Experiment details: - There were no canonical tags hard-coded on any of these pages - There were hundreds of duplicated pages for every page we wanted ranking in search results
I conducted this experiment on a site that had hundreds of duplicated pieces of content for every page we wanted appearing in search results. The original versions of these pages needed self-referring canonical tags and the duplicated pages needed canonical tags pointing to their respective original pages.
On March 3, I injected both types of canonical tags on the appropriate pages through GTM. We began seeing improvements almost immediately! When we started this experiment, there were nearly 3,000 pages in the index, most of which were duplicated pages.
The number of URLs in the index began dropping immediately from the depletion of indexed duplicated pages:
- 3/5: 2,796
- 3/6: 2,630
- 3/10: 2,500
- 3/13: 1,670
- 3/24: 1,330
Noindex Tags: Respected
Experiment details: - Rankings were for a completely made-up word, “asprigilency” - There were no robots meta tags hard-coded on the page
On March 19, I created a page targeting the keyword, “asprigilency,” to ensure our page would rank #1 as there is no competing content. The page took about 4 days to appear in the index for a search for “asprigilency.”
The same day it first appeared in the index, I injected a meta robots noindex tag through GTM. It took over two weeks with the noindex tag for the page to stop appearing in the index for this keyword. After its first disappearance from SERPs, it ranked on and off a few more times until it completely stopped ranking at all for “asprigilency.”
Hreflang Tags: Respected
Experiment details: - There were no existing canonical/hreflang tags on these pages - Pages for this experiment were created targeting a made-up word, “relamburgeoning” - One page was tagged for French-France but not actually translated in French - One page was tagged for Portuguese-Portugal and was actually in Portuguese
On March 14, I created two versions of the of the same page:
- Relamburgeoning page not translated in French
- Relamburgeoning page translated in Portuguese
The day I created these pages, I inserted the hreflang tags with “FR-fr” pointing to the French page and “PT-pt” pointing to the Portuguese page on both versions of the page. I tracked the following keywords:
- “Relamburgeoning” in market “PT-pt” in Portugal
- “Relamburgeoning” in market “PT-pt” with no location specified
- “Relamburgeoning” in market “FR-fr” in France
- “Relamburgeoning” in market “FR-fr” with no location specified
The Portuguese page started ranking immediately. For the nine days, only the Portuguese version of the page would rank for all variations of our tracked keyword, regardless of hreflang tag, location or market.
On March 23, the appropriate pages began ranking in their respective markets and locations. Even the page targeted for French in France ranked in France and for the market “FR-fr” although not actually translated in French.
TL;DR: It Depends
Google respects data injected through GTM depending on the situation and type of tag. If there is a hard-coded version of the tag you’re attempting to insert, the hard-coded tag may be respected over the inserted tag. These were the outcomes of the inserted tags through GTM:
- Meta page titles: Not Respected
- Canonical tags: Respected
- Noindex tags: Respected
- Hreflang tags: Respected
If you plan on injecting data onto your site through GTM, keep these troubleshooting tips in mind:
- You’ll only find the injected data in the DOM when you inspect the page, not in the page source
- You can check for this data in the DOM in preview mode before publishing your container
- Pay attention to which trigger type you use (Page View vs. DOM Ready vs. DOM Load) when you’re pulling pre-existing information on the page to populate a field in your injected tag
- Check for hard-coded versions of tags you want to insert; hard-coded is always better but injected is better than nothing