issue with Single Page Application measurement Google Analytics

Single page application – Proper PageView Measurement (solving issue with google and referrer traffic)

With single page application websites it’s quite challenging to implement Google Analytics as it often looses the proper source/medium of the session. Let’s find out why it does lose it and how to fix the issue.

 

Single Page Application – Google Ads traffic changed into Google Organic traffic

If a user clicks your google ads ad and comes to a page it generates a pageview where:

  • Referrer is google.com
  • url contains gclid (or utm’s)

 

Google will set the session based on gclid (or utm’s) as it is higher in ranking than referrer. So it seems everything is fine. Google will count such a session as from Google Ads. The issue emerges when a user makes a click on a site, which does not reload the page but changes the url. In such case a pageview will get:

  • Referrer is (still!) google.com
  • url does not contain gclid nor utm’s

 

In such case Google Analytics sees a pageview which has referrer google.com and url does not include any specific parameters. So it will set source / medium to google / organic. The same case is for any traffic with utm’s on the visit.

 

The results is that a user came to a site, made one click, and in such case Google Analytics will show 2 sessions (one from google / cpc, second from google / organic) !

Why it is not a problem on standard website?

 

Standard website (where each page view loads whole site)

The case described before will create no issue at all as the second page view will have referrer as a page domain. In such case for google it will be the same session, so no issue 🙂

 

Solving issue with single site application measurement in Google Analytics

The solution is to provide Google Analytics with proper referrer, meaning if it is a hit (for example page-view), without page reloading then provide referrer as page domain. In such case it will be seen for Google Analytics as in standard website 🙂

 

The easiest way (in Google Tag Manager) is to:

  1. Create a new varaible which will take normal referrer when Google Tag Manager loads on site:

Referrer google umt traffic issue single page application

 

2. Provide Google Analytics this variable as Referrer, to do so you need to update your Google Analytics settings:

 

SPA solving issue with trafic not properly measured

 

With those two changes your traffic should be properly measured

Thanks to Simo Ahava for such suggestion. It was on some group unfortunatelly I am not able to find where it was.

Leave a Reply

Your email address will not be published. Required fields are marked *