How to Filter Analytics Data in Reports?

Generally, our Google Analytics (GA) reporting widgets show unfiltered data in your custom reports. For example, this Analytics Data Table widget shows all 'Sources' from GA in a table.


But sometimes you want to report on just a subset of this data, for example by excluding '(direct)' from the report. For this, you will need to enable custom filters.


Enable Custom Filters

Applying a custom filter is easy with Optmyzr's Report Builder. Here's how it works:

  1. Select the checkbox "Enable Custom Filters."
  2. Specify the filter, for example: 'ga:source!=(direct)' (this translates to 'source is not equal to '(direct)')
  3. Preview the widget
  4. Save your Optmyzr report


What's The Syntax For Filters

How you specify the value of the filter, is determined by GA's Filter Syntax described in detail here: https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filterSyntax 

You'll also need to know what the segments and dimensions are so that you can have the correct value on the left side of your equation: https://developers.google.com/analytics/devguides/reporting/core/dimsmets#segments=true

When you filter something, there are two sides to the equation. The left is what metric or dimension you're filtering on, and the right side is what value you'd like to match or exclude. In the middle is the operator that specifies what type of match you'd like.

For example, the following says that the medium should include the word 'cpc':

ga:medium=@cpc

This says that the source should not be (direct):

ga:source!=(direct)

You can also combine statements by using the 'AND' operator which is written as a semicolon between statements. For example, this says that the source should be Facebook and the medium should be cpc:

ga:source==facebook;ga:medium==cpc

And this says that the source could be either facebook or google by placing an 'OR' operator between statements by using a comma:

ga:source==facebook,ga:source==google

Example of Filtered Data in Charts

Say you want to show a chart of the sessions and bounce rate for visits originating from AdRoll. With Optmyzr's Analytics Time Wise Chart, you're normally charting the sessions and bounce rate for all traffic in the GA view that's connected to the Optmyzr account so it needs to be filtered so you'd see a chart like this one:

To filter it down, first you need to determine the correct syntax for writing the custom filter. If you know exactly what the source is called in GA, you can write the filter directly in the Chart widget's field for Custom Filters. If you're unsure whether 'AdRoll' is capitalized or not, or if it is specified as 'adroll.com', you can create an unfiltered Analytics Data Table. 

Then, look at the Preview of this table to find the string that you're trying to filter for. Here you can see it's just 'adroll':

Now you can write the filter with the correct syntax. For example, write 'ga:source==adroll' if you only want the reporting widget to contain data from when the source is exactly 'adroll' and nothing else, and then the chart will be updated to include just that data like below:

If you're filtering for a campaign name or something where the text contains a space, just leave those spaces. We'll automatically convert it to the correct format to make sure you get the right data back. So if you're filtering for a campaign called 'hello world', your filter would look like this:

ga:campaign==hello world

Can’t find what you’re looking for?

Our award-winning customer care team is here for you.