Dave Fowler Does SEO

Google Analytics Advanced Filters AND OR

27/11/2017 By Dave

Google Analytics Advanced Filters example - using AND OR regular expressions

Say you run a business energy supply website, and at some point change the URL structure.

Old URL – domain.com/energy-for-business/request-energy-quote

New URL – domain.com/business-energy/quote

At a later date you want to compare the performance of the old and new quote pages within Google Analytics.

You also have pages for domestic energy quotes (domain.com/home-energy/quote), for business energy customers (domain.com/customer-area/business-energy), and a blog with business energy posts (e.g. domain.com/blog/10-tips-to-save on-your-business-energy).

First, use the Advanced Filter function to exclude the pages you don’t want in the report:

Exclude – Landing Page – Matching RegExp – home|customer|blog

(The pipe | separates words and acts as an OR instruction, so in the example above we are excluding any landing page URL that contains the words ‘home’ OR ‘customer’ OR ‘blog’)

Next, we want to include any remaining URLs that reference ‘business’ or ‘energy’. To do so we use the following:

Include > Landing Page > Matching RegExp > business.*quote

(The .* expression acts as an AND operator, in this instance looking for any URL that contains both the words ‘business’ and ‘quote’, in any order)

Filed Under: Analytics

Copyright © 2019 Dave Fowler

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok