Quick history. On May 23, 2014, the following announcement was made on the Google Webmaster Central Blog:
Read the full announcement here.
Anyway, since I see the world through GTM-tinted shades, I instantly figured that this should extend to not only the presentational layer, but to semantic information as well. At the time, I was thinking in terms of the Search Engine Results Page (SERP) and the Meta Description, which prompted me to ask the following in Google+ from Gary Illyes, who made the announcement:
As you can see, I didn’t get a direct answer, so I decided to run some tests. I created some test pages, and used Google Tag Manager to inject a Meta Description with a simple Custom HTML Tag (that fired on the test page only):
var m = document.createElement('meta');
m.name = 'description';
This simple tag creates a new
<meta name="description" content="This tutorial..."> tag and adds it as the last child of the
head HTML element.
So I published the test pages, had Google crawl them and ended up with…failure. For some reason, it didn’t work and I left it be, evangelizing to people to keep on adding the Meta Data directly in the page template.
Then, at SuperWeek Hungary this January, I had the pleasure of meeting Gary Illyes in person, and I relayed to him my test results. To add some additional context, I had just tested successfully and written about injecting structured data JSON-LD through GTM. Anyway, Gary was adamant that the crawlers should understand injected
meta tags, so I ran another series of tests.
Again, failure. But being your typical Finn, I refused to give up. So I ran three more tests.
Test 1: Pure Test Page
The first test I did was for a new page using my blog template, which had basically no content. Its title was “Test page” and the Meta Description was injected. After creating the page and setting up the tag in GTM, I published the page and asked Google to crawl the page via Webmaster Tools.
I added a lot of text and some images, but nothing changed so I abandoned the test as a failure.
Test 2: Real Content
The next test I ran was against real content. I had just written a blog post, and I decided to publish it with an injected Meta Description. This time, I was sure that the crawlers would render the Meta Description, as this was a real page with valuable content, and the Meta Description reflected this content very well.
Anyway, on this page I injected the Meta Description again, asked Google to crawl it and the test was…A SUCCESS:
The Meta Description in the SERP result above has been injected with Google Tag Manager. So it IS true:
Google’s crawlers index dynamically injected meta data as well.
Sorry if this was a no-brainer to you – but I had so many unsuccessful tests behind me that I wanted to be sure.
First of all, as you can probably see from my tests, this isn’t a 100 % sure method. So don’t delegate the creation and deployment of Meta tags to Google Tag Manager or any other dynamic, client-side solution. The best way is still to add Meta tags to the page template.
The incredibly interesting and reassuring thing here is that Google’s crawlers are really taking dynamic web pages seriously. This is a huge step in building an actual representation of the web, instead of just crawling source code that might have very little to do with what visitors to your website actually experience and find relevant.