How to Create a Filter to Tidy up Email Referrals

Roll up Yahoo Mail, Hotmail referrals

If you send marketing emails without campaign tagging or an external company e-mail your sites links to its users that have Yahoo Mail or Hotmail, users will arrive at your site via one of the many Yahoo or Hotmail servers. So searching for in your referral report gives you hundreds of referrers which are actually one and the same referral link.



You tend to get referrals like above ( ””). You can roll these together so you can see hotmail referrals grouped together by making changes inside Google Analytics so that reports are clearer and easier to breakdown.


Login to Google Analytics; select your profile you wish to roll up this data. Select Admin > Profiles > Filters



The next step is to create a New Filter.

These Filter you need to create will be a custom filter that will look at campaign sources and replace/rename the string with something that rolls them up into an easy to view source.

Filter type: Custom Filter > Search and Replace

The filter field that will be searched will be the Campaign Source and in order to ensure that all possible variables of the email source are collected a regular expression will be needed.

Filter Field > Campaign Source

Search String > “A Regular Expression” will need the following regular expression


Replace String with the name you wish to roll it to. I have chosen livemail.

Select Save.

Example below.

Windows Hotmail/Livemail:



This is a guest post contributed by James Cornwall

About James Cornwall

As Digital Analyst at 4Ps Marketing, James is responsible for the recently launched analytics department. After studying Civil Engineering at CITY University, James has undertaken a career in ecommerce and digital marketing. He is Google Adwords and Analytics Certified, and in his spare time is a keen hockey player. Ask James a Question: Follow on Twitter – @jamesc_4ps LinkedIn –

What are Filters in Google Analytics

Filters are a way to transform or manipulate the data that shows up in Google Analytics reports. Filters are applied on the data collected by Google Analytics and what you see in your reports is the final outcome after the filter has been applied to your data.

For example if you want to exclude traffic from an internal IPs then you setup an Exclude IP filter and apply it to the profile that you want to exclude the traffic from.  The final reports that you will see in that profile won’t include any traffic from those IPs.

Note: Once the filter is applied then you won’t see the original data in your reports, you will only see the transformed data.  So always apply a filter on a test profile before applying it to your main file so that you don’t accidentally mess up your reports in your main profile.

Google Analytics provides three predefined filters. If those are not the ones that you need then you also have an option to create custom filters.

Predefined filters:

  • Traffic from the domains: This filter allows you to exclude or include only the traffic from a specific domain.
  • Traffic from the IP addresses: This filter allows you exclude or include only the traffic from specified IPs.
  • Traffic to the subdirectories: This filer allows you exclude or include only the traffic to particular subdirectory on your site.

Example of a Predefined Filter

How to Exclude Internal Traffic from Google Analytics when Internal IP Address is Dynamic

Custom filters:

  • Exclude Pattern:  Allows you to exclude traffic that matches the pattern that you specify.
  • Include Pattern: This filter allows you to include only the traffic that matches the patter you specify.
  • Uppercase: Allows you to convert a given data into uppercase.
  • Lowercase: Allows you to convert a given data into lowercase.
  • Search & Replace: This allows you to manipulate the information you see in your reports by searching a value and replacing with something else. Say you have called your campaign source as Gogle instead of Google in your campaign URL. You can change it back to Google in this filter.
  • Advanced: This filter allows you to build a new data field from one or two other data fields. Some examples will be covered in future articles.


Examples of Custom Filters:

Regular Expressions and Google Analytics

How to Exclude Internal Traffic from Google Analytics when Internal IP Address is Dynamic

Note: Filters are applied in the Rank order, the rank 1 is applied first and then 2 and so on. To change the order use the Assign Filter Order button (see below).  Having the wrong order on filter will lead to unexpected results so make sure you have assigned the right order.