Indexation with JavaScript and GTM: A Quick and Dirty Test

Google and JavaScript: Will They Or Won’t They?

There has been a lot of talk about what Google will crawl and index and what it won’t when it comes to Javascript.

The one constant we’ve found is that no one really knows what Google’s crawler will do with your Javascript content. It might crawl it. It might execute it. It might index it. Unfortunately, the decision seems to be made on a case-by-case basis.

With that in mind, we decided to throw our anecdotal results into the fray to demonstrate what Google will do in this very limited case. We also hope to inspire you and your team to do what I call “quick & dirty” tests.

Our Test

Here is a quick little test we ran here at UpBuild.

Our goal was to see what Google will crawl and index when using different methods of Javascript to insert content onto the page.

We used my personal site for testing (, because the site is extremely basic in its configuration (built on the Flask framework) and it was really quick to prototype. I’m also not concerned with destroying the site in the name of testing.

In this test, we did the following:

  • We made up a word that triggered no results in Google. That phrase was blamboopderpdug.
  • We then created a new page on at /blamboopderpdug/.
  • We put our made up keyword on the page within an H2 tag in plain HTML. No Javascript.
  • We submitted the page to Google’s index and it was indexed within a few hours and was ranking for our keyword, “blamboopderpdug”. Nothing surprising so far. This was expected.

  • The next day we inserted another made up word, ulkndwkdhzow, on the page, but this time using the Javascript method .append(). We also used an H2 tag on this keyword so that, in theory, both keywords would be weighted the same. This was done in-line rather than in an external file.

  • We had Google recrawl the page and within a few hours our page was being returned for “ulkndwkdhzow” as well as “blamboopderpdug”.

At this point, it was pretty clear that Google would crawl, execute, and index content inserted with inline Javascript. At least in this limited case.

Over the next couple of days we found that our page dropped in and out of the index for “ulkndwkdhzow” but never for “blamboopderpdug”. This leads us to believe that Google couldn’t decide how to handle the content we were inserting with Javascript.

  • We decided to take it a step further and test to see if another method of inserting text would work. So, we used the same Javascript code we used for “ulkndwkdhzow” but this time executed it with Google Tag Manager and with another made up word,  “nnnndndkskdowd”. Then we had the page re-crawled, a third time.

Within 1 hour of submitting the page to the index, Google was returning our page for “nnnndndkskdowd”, our third made up word.

Using Google’s crawl and render feature we were able to see exactly what Google was seeing. As we can see below, Google was able to execute our Javascript and all three of our keywords are on display.

So, far we’ve had no trouble getting content indexed using plain inline Javascript or Javascript inserted with Google Tag Manager. The caveat here is that our page seems to drop in and out of the index for the keywords inserted with Javascript.

What does all this mean?

Anecdotally, it means that Google absolutely can crawl, execute, and index content inserted with Javascript.

Of course, as with any good experiment, more questions were created by our results than actual answers.

Here are just a handful of the questions these results create:

  1. Why was the page dropping in and out of the index for our keywords inserted with Javascript?
  2. Is Google weighing their importance?
  3. Or the method which they were added?
  4. Would this work for a large block of text?
  5. Or with something inserted with Javascript using an external script?
  6. How much did our first keyword (blamboopderpdug) appearing in the URL for the page affect it staying constant in the index?

Broader Take-Away

Beyond this one test, our goal here is to show that anyone can run a simple test, or a “quick & dirty” test. Sure, this isn’t 100% scientific, and it’s easy to poke holes in our data (or lack of data), but we can prove, at least anecdotally, that Google will index JavaScript content. Whether this scenario could be replicated on your site is unknown; Google’s overall actions can be unpredictable.When it comes down to it, as SEOs, all we can do is run tests and try to draw conclusions from correlations, because unless we have access to the algorithms and directives that drive Google’s bots and rankings, we’ll never know for sure why our tests had the effect they did.

We encourage everyone to run quick & dirty tests all the time, with anything they can think of. Sure, your data might not be completely valid or useful to everyone, but in many cases, we’re just trying to see if something CAN or CAN’T work in a certain situation. Quick tests like this can be the first step in a bigger, more thorough test.

Related Posts

Leave a Reply

Your email address will not be published.