Google Analytics Tagging And Website Redirects
Google Analytics is a brilliant tool. It’s only as good as the data you pass back to it though.
AdWords and Bing Ads make it easy to auto tag your PPC traffic for analytics, but you need to put a lot of effort into making sure that all your traffic sources are tagged correctly. See https://support.google.com/analytics/answer/1033867?hl=en for an intro to tagging your traffic correctly.
But even if all your traffic is tagged perfectly, it is not guaranteed that your web site will not destroy these tags in some situations e.g. 301 and 302 redirects.
I had seen this happen with a Magento site which had an SEO plugin which when implemented, appeared to reduce conversions from Google Shopping traffic in Analytics to zero (though it took a while to work out what was happening as it only affected Shopping campaigns and not other AdWords campaigns, because 301 redirects were only happening on product pages and not category pages).
So, what exactly is the situation with redirects? What *will* and what *will not* mess up your tracking on your web site?
I got a very helpful reply from Google AdWords support which I have pasted almost verbatim below. Short summary is that redirects generally will mess up your tracking. :-
Whether a redirect is “destroying” the parameter used to tag a URL, depends on how you implemented the redirect. e.g. https://www.ppcni.com/blog?gclid=test123 does not provide Analytics with the parameters required to track your URLs. So – yes, your 301 redirect will destroy the tagging for Analytics.
However, there is a solution to this problem
It’s best to use the Chrome Developer Tools to help you troubleshoot.
Turn on Record in the Chrome Developer Tools (black circle on the bottom bar in the Network tab). Enter the original destination URL with the test parameter appended into the address bar. Press Enter to load the URL.
Under the Networks tab and Headers pane on the right, click some of the first requests listed–they will generally not be type-specific requests (no image or code file extensions).
Inside the request, look for an HTTP status code of 301 or 302.
Under the Response Headers section, look for the Location value, which indicates where the browser has been redirected. (Note that redirects can consist of multiple legs, so you might have to check several page HTTP requests to find out where the parameter is lost).
If the new URL doesn’t have the parameter and the value you specified earlier, then it’s likely that Google Analytics has not been able to store the parameter value.
In some cases, you might not see parameter in the final landing page URL but the Analytics code from the previous page might still have sent it in the redirect process (this usually happens too quickly to observe by eye). To check if the parameter was sent by the Analytics code on a previous page, look at the collect request made by the page. Use the filter icon to help sort or search for collect requests. (In your case: it did not send this request).
In Chrome Developer Tools, under the Networks tab, click on the collect request in the left pane (if it’s there).
In the Headers pane on the right, under the Query String Parameters section, look for the dl parameter in the collect request.
You should see your parameter. If you don’t see this value, then the parameter was not successfully parsed and stored by Google Analytics.
To resolve an issue where the Google Analytics tagging parameter is being removed by a redirect, and if the redirect is caused by a server-side rule, and you can’t stop the redirect, configure your server to allow redirects to carry query parameters from the initial URL to the final URL.
For example, the URL with your tagging is: www.example.com/redirecting-page?gclid=TeSter-123, when the redirect occurs it should forward the user to www.example.com/new-url?gclid=TeSter-123 (note here that the gclid parameter remains the same, although the page URL changes).
*NB – none of this affects AdWords conversion tracking *unless* you are importing goals/transactions from Google Analytics as conversions into AdWords.