What we think

SEO and JavaScript redirects: Evidence they do pass PageRank

TL:DR

Google does pass PageRank through JavaScript redirects.

Google and JavaScript

For a while there has been speculation about just how advanced Google is at picking up content, links and redirects in JavaScript.

Our very own Patrick Altoft wrote about how Google can pick up links and anchor text in JavaScript back in June 2009. Google even announced in May 2014 that they are working on understanding webpages better by executing JavaScript and CSS files.

In May 2015, Adam Audette and his team ran some very extensive tests to see how Google executes and indexes JavaScript, proving that Google does pick up SEO signals (meta robots, title tags, canonical tags) which are dynamically inserted.

Here at Branded3, we have been running our own tests and want to share the results of an interesting experiment with a JavaScript redirect.

The science bit

There are a lot of variables in search that weren’t accounted for (fresh links, search interest, etc.) and so this test is not truly “scientific”. The only thing that was changed by the team was adding the JavaScript redirect code to one of the pages we were working on.

When we ran the test, we didn’t know if Google would pick up the redirect and even if it did, we didn’t know if it would pass any value to the redirected page. We therefore hypothesised that the client side redirect wouldn’t pass any value like a server side 301 redirect.

Choosing the blog post

To begin, we had to find two similar posts that ranked well for search queries and had a high number of impressions and clicks. Thanks to our founder Patrick Altoft (the blogging machine), we had a lot of blog posts to choose between!

We chose two pages that had similar content and intent:

Page A: edit.co.uk/blog/htaccess-mod_rewrite-ultimate-guide/

Page B: edit.co.uk/blog/setting-up-permanent-301-redirects-in-htaccess/

Page A was an old post by Patrick which ranked well for a number of keywords around the .htaccess file.

Page B was written by Mathew McCorry, who has written a number of technical SEO articles for the Branded3 blog. Mat’s blog post ranks for a number of long tail keywords.

Once we had chosen the two blog posts, we wrote the JS redirect code (which you can see below) and added it to Page A, redirecting it to Page B.

tag

The results

Once we had made sure that the JS redirect was working, we prompted Google to come and re-crawl the page on the 18th July using Fetch as Google.

results

Our team didn’t have to wait long because after a couple of days (20th July) we began to see a drop in the number of organic sessions, impressions and clicks for page A.

1

2

Page A: edit.co.uk/blog/htaccess-mod_rewrite-ultimate-guide/

Around the same time the number of organic sessions, clicks and impressions for page B increased and Mat’s blog post began to rank for keywords which page A used to rank for.

3

4

Page B: edit.co.uk/blog/setting-up-permanent-301-redirects-in-htaccess/

When now searching for “htaccess mod_rewrite” in Google, Mat’s post has replaced Patrick’s (it is now at position #1 when I search in incognito).

6

Furthermore, when doing an “info:” search operator for page A, Google is showing page B, indicating that Google has passed the value of page A to page B in its index.

7

JavaScript redirects can pass PageRank

This test was quick and more tests need to be run to see whether Google can consistently pick up these types of client-side redirects in large volumes. However, what this test does indicate is that Google can not only pick up a JavaScript redirect but that the search engine can treat it like a 301 redirect.

What does this mean for SEO?

So, does this mean that we can start using client-side redirects instead of server-side redirects for our SEO activities?

I wouldn’t recommend it without testing.

A lot of tests have been run to see if JS is picked up by Google and all have shown that it can be irregular in what it picks up, even our own tests have shown this.

Something else you need to consider is that Google is the only search engine advanced enough to pick up the dynamic change (for the moment). I did a quick search in Bing and the page A still was still ranking as you can see from the image below.

8

For the time being I would stick to server-side redirects, which is what Google currently recommends, but if you’re really stuck and can’t get the redirects implemented then this might be a short-term solution. But remember, test is best.

Please make sure you if you’re going to implement JavaScript redirects test them out first!

Related posts