Menu

How To Fix Self-referrals In Google Analytics?

Gordon Choi
Gordon Choi
Author

Websites

Self Referrals can cause data integrity issues in Google Analytics.

When you get self referral data in your reports, it means the referrers (i.e. sources) that shows up in your Google Analytics reports have been inaccurately assigned.

What are the Causes of Self-referrals in Google Analytics?

Self referrals can usually be caused by one of the scenarios.

  • Client-side Redirects
  • Untagged Web Pages

Client-side Redirect vs. Server-side Redirect

Consider the case below.

  • You used to have an old URL m.example.com/page-A and you have been sending your users to this page.
  • Then you have created a new page (m.example.com/page-B) to replace the Page-A. Now you are sending your users to page-B.
  • However, there are many users who still are visiting your old page, Page-A.

To resolve this issue, you have set up URL direction from Page-A to Page-B. When your users visit Page-A, they will automatically be taken to Page-B. You can set up this redirect with a few methods.

URL DirectionAnalytics
Server-side 301Okay. http referrer header is preserved.
Server-side 302Okay. http referrer header is preserved.
Client-side RedirectProblem. http referrer header is not preserved.

You can always use the Chrome browser’s built-in Developer Tool to verify if a redirect has been set up on the server-side as a 301 (or 302) redirect.

Redirects in Chrome Developers Tool

This line confirms it is a server-side redirect.

Status Code 301 Moved Permanently (from cache)

If you do not see the status code being reported as 301 or 302, then it is a client-side redirect.

  • A client-side redirect happens with the browser itself.
  • During a client-side redirect, Page-A and Page-B are loaded in succession, i.e. Page-A is loaded, and then it is followed by Page-B.
  • This triggers two page views in succession without any click or interaction by a user, where the first page view (from Page-A) is never recorded by Google Analytics, and the source referrer (i.e. the previous page’s URL) is lost.
  • Your Google Analytics will end up reporting your own domain name (i.e. self-referral) as a source which is incorrect.



On Page-A, you have this code in the section that performs a client-side redirect in the web browser.

    
<head>
<title>Page-A</title>
<meta http-equiv="refresh" content="0;URL='http://m.example.com/Page-B'" />
</head>
  • The meta element has the value of the http-equiv attribute set to “refresh” and the value of the content attribute set to “0” (meaning zero seconds), followed by the destination URL (i.e. the redirected URL) in which the browser is to request.
  • The refresh time is set to zero seconds. Page-A is never displayed to the users before it is redirected to Page-B, which happened all on the client-side.

In practical when taking your users automatically from an old page to a new page, you should always only use server-side 301 (or 302) redirect. Server-side 301 (or 302) redirect preserves the referrer information which is good practice for web analytics.

Untagged Web Pages

Consider this scenario in which you have two pages on your website.

m.example.com/Page-A
m.example.com/Page-B
  • Page-A has no Google Analytics tracking code installed.
  • Page-B has Google Analytics tracking code properly installed.

A user lands on Page-A. While on page-A, this user clicks a link that takes him / her to Page-B.

  • On Page-A, no Google Analytics tracking code has been triggered, and nothing is recorded by Google Analytics.
  • On Page-B, Google Analytics starts a new session for the user, and assigns your own domain name to the source referrer.
source=m.example.com
medium=referral

This source referrer information recorded by Google Analytics is incorrect.

For good practice, you should always ensure installing your Google Analytics tracking code on all your web pages.


Previous Chapters

Next Chapters





Content on Gordon Choi’s Analytics Book is licensed under the CC Attribution-Noncommercial 4.0 International license.

Gordon Choi’s Other Books:
The China Mobile SEO Book
Mobile Website Book



How To Install Google Analytics on WordPress?

Setup Guide for WordPress websites: Set up Google Analytics on WordPress website to track/measure user behavior data. Optimize your website & traffic/marketing strategies based on GA reports.

How To Install Google Analytics on Shopify?

Setup Guide of Google Analytics on Shopify websites and/or online stores: Track the behavior of your Shopify website visitors. Improve your digital marketing campaigns based on the measured data.

Google Ads (AdWords) Setup & Optimization Checklist

Setup Guide of Google Ads (AdWords): After installing analytics, get people to visit your website through Google Ads. Optimize Google Ads in 2 phases: One-time setup & ongoing optimization. Build ad campaigns that can always return highest sales with lowest cost.

Copyright 2016-2020 www.AnalyticsBook.org