Introduction
Following up on our earlier experiments and for the purpose of validating the technical concepts behind our personalization platform Unless.com, here are the results of a series of experiments to see what gets indexed and what doesn't if Javascript is used to inject content in your page.
In summer 2018, we tested Google, Bing (and Yahoo), Yandex and Baidu.
Experiment method
Each experiment consists of a sentence with a unique string that gets injected by Javascript, using several different techniques. After indexing by the search bots, you can use this string to validate if the associated search results are showing up or not by simply performing a search query in each search engine - proving the Javascript indexing capabilities of each of those.
We let the experiment run for several weeks, and these are the results. You can also download the source code, so you can repeat it yourself.
Injection before DOM has loaded
This experiment writes a string into a DIV element with Javascript synchronously. For the test to be succesful, the following content should get indexed.
Help engines find dynamically injected content, and this is proof: WrPekZCDMg
Results
Bing
Yandex
Baidu
Injection after DOM has loaded
After the DOM has loaded, this experiment writes a string into a DIV element with Javascript. For the test to be succesful, the following content should get indexed.
Help engines find Javascript content that is injected after the DOM was loaded, and this is proof: 0ieQgguBQp
Results
Bing
Yandex
Baidu
Asynchronous injection
After a time out of 1000 milliseconds, the experiment writes a string into a DIV element. For the test to be succesful, the following content should get indexed.
Asynchronously injected content can be found in search results, and this is proof: 7Cw6GVRR7p
Results
Bing
Yandex
Baidu
Injection after httpRequest
This experiment loads a JSON file and then the callback function injects a DIV with a string using its data. For the test to be succesful, the following content should get indexed.
Even with httpRequest() you can fetch content. Help engines will find it. Proof: Jgv0PGmZRL
Results
Bing
Yandex
Baidu
Meta elements injection
Synchronously, the meta description was replaced by another one containing a unique string. For the test to be succesful, the following content should get indexed and shown as the description in the SERP. Compare the unique string. Note: the next experiment might overrule this one.
Do search engines index meta elements injected by Javascript? Look at 5ZW1D7Fmvk for proof
Results
Bing
Yandex
Baidu
Meta elements injection, asynchronous
Using a time-out function, the meta description was replaced with a new one, containing a unique string. For the test to be succesful, the following content should get indexed and shown as the description in the SERP. Compare the unique string. If this experiment is succesful, the previous one will also work.
Do search engines index meta elements async injected by Javascript? Look at GMuPPfM0lw for proof
Results
Bing
Yandex
Baidu
Bonus: injection by Unless variation
This experiment loads an Unless variation that contains a unique string. We prefer that the following content does not get indexed - because Unless variations should not be shown to search bots. Let's see.
If search engines index Unless variations, you will see GFgfT64FKk in the SERP.
Results
Bing
Yandex
Baidu
Conclusion
Google scores best on crawling and indexing of dynamic content. All content gets indexed, whether it is synchronous or asynchronous, or via http request or delayed otherwise. As expected, the Unless variation does not show up - this is by design, since it shows personalized content to people, not search engines.
Bing
We can be short about this. Bing (or its little brother Yahoo) does not show dynamic content in its search engine results pages.
Yandex
Yandex is doing quite well in crawling and indexing javascript text. However, it fails top recognize meta elements like page title and description if you set this from a script. As expected, it does not show personalized Unless content.
Baidu
Baidu does not seem to recognize any content that was injected with javascript.