English Posts

Search and Replace Filter in Google Analytics

search and replace filter in google analytics

Google Analytics gives you the possibility to use Filters to clean and better organize your data. This can help you a lot for your analysis.

Among the different types of filters, Search and Replace Filter allows a convenient help to substitute a value with another one more useful and, above all, more readable.

Want to know more about how to use filters in GA? Read this.

Create the filter

Let’s go in Admin – View (choose the view where you want to apply the filter) – Filters and create a new one.

Let’s suppose that GA is collecting data from your domain both with www. and without www. .

To avoid this and reduce the number of cardinality, making your analysis more qualitative, we create the following filter:

  • Filter name: Search & Replace www.
  • Filter type: Custom
  • Search and Replace
  • Filter Field: Hostname
  • Search string: ^esempio\.it$
  • Replace String: www.esempio.it
search and replace filter in google analytics

Save it.

In this way, Google Analytics will only show us the value www.esempio.it every time it finds a value that starts and ends with ‘esempio.it

This is the reason why I type, thanks to the Regular Expressions, this: ^esempio\.it$

Search and Replace Filter: Misspelling

As you’ve seen, the purpose of the Search and Replace Filter is to find a value and replace it with another one that you indicate.

For this reason, there are as many application cases as can be useful for your work.

For example, this filter can also be useful to correct any spelling mistakes when you or some of your collaborators fill in the utm parameters for campaigns.

We can create a filter that corrects the (misspelled) ‘affilaite‘ value with the correct ‘affiliate‘ value.

Simply create a filter with the following rules:

  • Filter name: Search & Replace affilaite
  • Filter type: Custom
  • Search and Replace
  • Filter Field: Campaign Name
  • Search string: affilaite
  • Replace String: affiliate
search and replace filter with misspelling

Having the possibility to choose the dimension type, both native and custom, you have lot of possibilities to use this filter.

The main advantage of the Filters is that you can manage them both in the View and into the Account.

filters in admin analytics

Search and Replace Filter: Facebook

The typical situatione you can face, is when you find several values on Facebook Source dimension:

facebook source dimension google analytics

With the Search and Replace Filter you can fix this problem easily. Let’s create a new filter with the following settings:

  • Filter name: Search & Replace Facebook Campaign
  • Filter type: Custom
  • Search and Replace
  • Filter Field: Campaign Source
  • Search string: ^.*facebook.com$
  • Replace String: facebook

As you can see in the image below:

search and replace filter facebook

I suggest you to test the filter by clicking on “Verify this filter”:

verify this filter google analytics

You can see how your data will change after you are going to apply this filter.

filter verification google analytics

You can follow the same rules above if you had a similar issue with other social media as Instagram.

Good analysis! 🙂

You may also be interested in the following articles:

How to solve the 5 million cell limit in Google Sheets

How to track Single Page Applications with Google Tag Manager

Query Parameters and Google Analytics

Tracking Google Data Studio Dashboards with Google Analytics

Schedule Emails in Google Data Studio

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *