Google Analytics Advanced Filters and Their Impact on Custom Session-Scoped Dimensions

by Nikolay Gradinarov

Fully understanding the concept of Sessions in Google Analytics can be a lot like cutting a path through the jungle. One of the many twists and turns along the way has to do with how the standard allocation logic of session-scoped dimensions changes when they are used in combination with advanced filters.

Introducing the Concepts in Play

  • Session-scoped dimensions in Google Analytics are documented by GA to allocate credit to the last value seen in the Session. A basic example of this: if during a given session a visitor started out with a membership status of "silver" and got upgraded to "gold", a Session-scoped dimension that tracks the visitor's status would only show the value "gold" (the last observed value) for the Session in question. As a result any KPIs registered during the Session will be credited towards the value "gold" as well. 

 

  • Advanced Filters allow you to pick data from two separate fields and output combined data to a new field. This can be useful in all kinds of situations when the data is available in a given field in the tracking request and through either complete or partial text extraction (including the use of wildcards and RegEx) the data can be assembled into a brand new field (which could be a custom or built-in Session-scoped dimension).

Let's say membership status information happens to be available in the query string of some site URLs:

www.mysite.com/url?status=silver
www.mysite.com/url?status=gold
 

An advanced filter can be used to extract the values of the "status" query parameter and populate a session-based custom dimension called "Membership Status":

 

 

Different Ways to Accomplish the Same Result

Assigning values to GA custom dimensions can be accomplished in a number of different ways. If an organization uses Google Tag Manager (GTM), a similar logic for setting "Membership Status" can live there, and the value can be sent more easily to multiple GA properties without having to configure multiple Advanced Filters.

Organizations that don't use GTM can pass custom dimension values using the analytics.js / gtag.js "set" command:

ga('set', 'dimension5', 'silver');

In such scenarios, the dimension will be populated directly in the network request that gets sent to Google Analytics and will appear as a name-value pair (e. g. "cd5=silver"). which will then be used to populate the dimension in Google Analytics.

On the surface having the flexibility to set custom dimensions in different ways is a good thing, but in the context of session-scoped dimensions the results are quite surprising. Specifically, using methods on the page itself (GTM, gtag) results in "last in session" attribution, while Advanced Filters silently give credit for any conversions to only the first value in the session. 

 

The Impact of Setting Session-Scoped Dimensions Set via Advanced Filters

In a nutshell, the allocation logic no longer credits the last value observed during the session with conversions, instead the first value gets all the credit.

In the membership status example, where the user starts out the session as a "silver" member and is then upgraded to "gold", Google Analytics will produce two different outcomes for the dimension "Membership Status" depending on how the dimension is populated. 

  1. If the custom dimension (for this example custom dimension of index 5) is populated via GTM or other custom tagging and the network requests first contain "cd5=silver" followed by "cd5=gold", the "Membership Status" dimension will only show the value "gold" and all KPIs will be credited to "gold". This is consistent with Google's documentation on the topic as this is the last observed value.
  2. If the custom dimension is populated using the advanced filter technique, the "Membership Status" dimension will only show the value "silver" and all KPIs will be credited to "silver". 

To state the obvious, understanding the difference in the allocation logic is super important for any data attribution exercise. 

 

Even More Fine Print for the Detail-Oriented

In some cases Google Analytics forces a new session to be created, even though the current session has not technically ended. A prime example for that is when a user enters the website via multiple different campaign codes during the same session. Since the advanced filter technique can be freely used to populate the Medium, Source, Campaign, Campaign ID dimensions - this produces additional "irregular" behaviors. Below is a table that summarizes some of the results:

 

Set In Network Requests

Set Via Advanced Filters

Custom Session-scoped Dimension by itself  
  • Last value gets credit

 

  • Sessions metric = 1
  • First value gets credit 

 

  • Sessions metric = 1

Custom Session-scoped Dimension + utm_source, utm_medium, utm_campaign parameters on the same hit

 
  • Each custom dimension value that coincides with an instance of the _utm param gets recorded

 

  • Subsequent hits (without a campaign instance) are allocated to the last custom dimension value. 

 

  • Sessions metric increments by 1 for each hit with utm_ params
  • Each custom dimension value that coincides with an instance of the _utm param gets recorded

 

  • Subsequent hits (without a campaign instance) are allocated to the first custom dimension value.

 

  • Sessions metric increments by 1 for each hit with utm_ params

Custom query parameter(s) are used instead of utm_source, utm_medium, utm_campaign

 
  • Each campaign value instances is captured and creates a new session

 

  • Subsequent hits (without a campaign instance) are allocated to the last custom dimension value.

 

  • Sessions metric increments by 1 for each hit with campaign params
  • Each campaign value instances is captured, but only one session is counted.

 

  • Subsequent hits (without a campaign instance) are allocated to the first custom dimension value.
  • Sessions metric increments by 1 only for the first campaign value instance

 

  

 About QA2L

QA2L is a data governance platform specializing in the automated validation of tracking tags/pixels. We focus on making it easy to automate even the most complicated user journeys / flows and to QA all your KPIs in a robust set of tests that is a breeze to maintain.


We take a smart, targeted approach to issue discovery via auto-selective site audits and scans and can help your organization on the path of improved data governance and data quality.

Contact Us

Tags: Data Quality Google Analytics Tips

QA2L is a data governance platform specializing in the automated validation of tracking tags/pixels. We make it easy to automate even the most complicated user journeys (flows) and to QA all your KPIs in a robust set of tests that is a breeze to maintain.

Try it real quick:

Subscribe to our quarterly data quality newsletter: