Eight Steps to Cleaner Data in Google Analytics
By: Tom Petryshen
Tags: Analytics, Data Analytics, Marketing, Ecommerce, Data Analysis

4. Normalize your Data on the Fly

A common issue with Google Analytics is that you may see separate entries for what are effectively the same campaign name, content or page URL. The reason for this is that Google Analytics is case sensitive and captures each string as unique and distinct from others. In other words, if you’ve used campaign names for your marketing campaigns that include both lowercase and Uppercase (such as red dresses, Red Dresses and Red dresses) Google Analytics will treat them as separate campaigns rather than one in your reports.

For best practices, it’s important to account for casing through the use of filters to normalize data during collection.

Example: New filter to normalise all campaign names in lowercase

For example, to fix the red dresses scenario described above, it’s as easy as creating a filter to normalise your campaign names into a single source as show in this example.

To be safe, the same fix could also be applied to Campaign Source, Medium, Term and Content.

The same is true for your page path URLs. If the URLs on your site use a mix of upper and lowercase characters it’s possible to see /ThankYou.html and /Thankyou.html as two different pages. To combine the two into one, create another filter as shown here.

Example: New filter to normalize path paths to lowercase

Outside of campaign tags and page paths it’s also helpful to combine the different variations of a source such as Facebook into a single source. A quick look at your Social channel will show that most social networks send traffic from a number of different URLs. For example, it’s not uncommon to see traffic from Facebook under the following domains:

m.facebook.com

l.facebook.com

facebook.com

business.facebook.com

lm.facebook.com

A quick way to combine the different variations into a single source is to create a new filter that finds and replaces each of the domains under a single source using the following search string:

(^|.*\.)facebook\.com$|^facebook$

Example: Search and Replace filter to combine all Facebook traffic as a single source

Though these quick fix can be quite helpful for standard normalisation, it likely won’t cover all scenarios, especially if your site collects the value of a user entry. Under this scenario, your users could potentially enter the name in multiple ways leaving you with multiple variations of potentially the same entry. The end result makes analysis more difficult and forces you to cleanse the data in other ways.

Outside of the Campaign Name, Page Path and Facebook filters covered above, filters can be applied to other types of scenarios such as excluding your IP address and removing query parameters appended to URLs.

Here are some of my go to filters:

Lowercase Campaign Name, Source, Medium, Content & Page Paths

Combine all Facebook, Linkedin, Twitter, Instagram & Pinterest sources

Remove all Query Parameters from Page Paths

Exclude Internal Traffic from IP Address

Include your Hostname (see section 5)

Exclude Referral Spam & Crawlers (see section 6)

For a full list with examples, check out Taavi Kalvi’s 30+ Google Analytics Filters.

If wrangling data in Google Tag Manager is more your style, then Yasen Lilov provides an elegant way of dealing with mixed cases and null data in GTM as well. Normalising null, false or undefined values with (not set) or N/A is important as Google Analytics will otherwise ignore hits from undefined values.

Example: How to normalise data in Google Tag Manager

By implementing filters and applying format values in Google Tag Manager, you’ll end up saving yourself heaps of time and frustration when you need to analyse the data.