302 Re-directs and the impact on Google Analytics data
302 re-directs are a very common theme in today’s web development infrastructure. Users who visit pages that are no longer active (or have a new version) will automatically be sent to the new appropriate page. While this feature is a blessing in disguise from a user experience POV, this does have a serious impact in web analytics tracking.
This article will address the following questions:
Does this have any impact on site analytics? (SPOILER ALERT - It does)
Is there anything that can be done to minimize (or negate) this impact? (SPOILER ALERT - there is)
Impact of 302 re-directs in Google Analytics data:
Assuming a Google Analytics (GA) tag is placed on both pages (article and article-new), how will page view data be recorded?
GA page view data (in most cases) is only recorded for the resolving URL (article-new).
It is very unlikely that the GA Tag will fire on re-directing URL (article). This is because either the re-directing page may:
a. Not support execution of code
b. Re-direct before the Javascript call from the code can be made
How does this impact the Google Analytics reports?
This has a direct impact on how GA attributes each visit. In this case, the landing page is counted as the resolving URL (article-new) and the re-directing page (article) is the referrer. The fact that this visit was through a Google Ad has been lost.
Resolution to the GA attribution issue
As you may have seen above that when the re-direct happened, the new page lost the gclid query string parameter. Preserving the gclid (or any other query string parameters from the re-directing URL) will ensure that attribution data remains intact. The landing page will still be the resolving URL (which logically speaking is correct) and the visit will be attributed to the original acquisition based on the preserved UTM (or query string) parameters.