Google Analytics filters and segments: All you need to know

Google Analytics isn’t just a great tool to track your online traffic, it’s also a powerful engine to slice and dice data. Their filtering and segmentation features make it easy to play with the data and discover tons of relevant information for your business. In reality, no marketer should ignore the power of filtering and segmentation!


DashThis is the perfect tool to easily filter and segment your Google Analytics data.

Don’t have an account yet? Have a look for yourself with a free trial!




1 – The advanced segments


1.1 – Know what it is


A segment is a subset of a population. For example, men and women are two segments of the human population. Children are one as well. In the analytics world, a segment could be your PPC visitors or those coming from the Organic search. This could be the mobile visits too. Or more specifically, a segment could be those who purchased a specific type of product or visited a specific section of your site.

In DashThis, advanced segmentation is useful to create KPIs on only a certain subset of your online traffic.

» Learn more about Google Analytics advanced segments.


1.2 – Create one


It’s pretty simple actually, but very useful. You can build complex segments if you want; have a look at the Google Analytics tutorial on How to build segments.


1.3 – Use it in DashThis


That’s the easy part: every Google Analytics default segment, as well as every segment you create, will be loaded in real time in our Custom Widgets. You simply need to select the required one.



2 – The filters



2.1 – Know what it is


Filters in the context of Google Analytics API are different from the filtered view concept. Filtered queries restrict the rows that do (or do not) get included in the result. Each row in the result is tested against the filter: if the filter matches, the row is retained and if it doesn’t match, the row is dropped.


2.2 – The difference filter / segment


While most of the time, the result of using a filter or a segment will be the same, there’s a slight difference between the two. Where the segment will determine which sessions are included in the results, the filter will determine which rows are shown. In other words, the segment is applied BEFORE the results are returned, while the filter is applied to the result that is returned.


2.3 – Create a Google Analytics filtered query


Have a look at the filter syntax, operators and expressions here. All the available data fields are listed here. The form of a filter looks like this:

ga:nameoperator  expression

Where ga:name is the field of the metric or dimension you want to filter on, the operator is how you want the field to be compared (equals, not equals, contains…), and the expression is the value of the comparison. So, for example, you should read it like this: Source Equals Organic.

We know this can be confusing for non-technical people, but we are here to help if needed!

Here are the operators you’ll most likely need:

  • • == Exact match (ga:source==google)
  • • != Does not match (ga:source!=yahoo)
  • • =@ Contains substring (ga:source=@dashthis)
  • • !@ Does not contain (ga:source!@dashthis)
  • • =~ Regular expression match (ga:source=~(google|bing|facebook))
  • • !~ Regular expression doesn’t match (ga:country!~(canada|france|australia))


You can also combine filters with an AND or an OR.

  • • AND is “;” like ga:source==google;ga:medium==cpc
  • • OR is “,” like ga:country==France,ga:country==Canada


2.4 – Main uses


Here are the most frequently used filters by our clients. No description needed, they speak for themselves!

  • • ga:medium==cpc
  • • ga:medium==organic
  • • ga:medium==referral
  • • ga:eventCategory==Conversions
  • • ga:eventCategory!=CategoryName
  • • ga:eventCategory==CategoryName
  • • ga:medium=~(cpc|ppc);ga:source==google
  • • ga:medium==cpc;ga:source==google
  • • ga:socialNetwork!=(not set)
  • • ga:source==google;ga:medium==cpc
  • • ga:source==google
  • • ga:medium==cpc;ga:source==google;ga:campaign!=(not set)
  • • ga:source=~(google|bing);ga:medium==cpc
  • • ga:adDistributionNetwork=@search
  • • ga:adDistributionNetwork=@content
  • • ga:medium==organic;ga:source==google
  • • ga:medium==cpc;ga:source==google;ga:campaign!~YouTube
  • • ga:source==bing
  • • ga:medium!=cpc
  • • ga:medium==cpc;ga:source==google;ga:campaign!~Display
  • • ga:medium==email
  • • ga:medium==cpc;ga:source==facebook
  • • ga:isTrueViewVideoAd==Yes
  • • ga:campaign==CampaignName
  • • ga:source==Facebook
  • • ga:medium==email;ga:campaign!=(not set)
  • • ga:source==facebook;ga:medium=~(cpc|social_paid)
  • • ga:source=@NameOfSource
  • • ga:adDistributionNetwork=@search;ga:campaign=@CampaignName
  • • ga:campaign!~(not set)
  • • ga:pagePath=@/WebsiteSection
  • • ga:country==Australia
  • • ga:deviceCategory==desktop
  • • ga:isMobile==Yes


Still not sure how to write the filter you’re looking for? Don’t worry, we made ourselves a Google Analytics Filter Tool that you can use to get your filter syntax just right.

* This is a beta tool, and at the moment, everyone can access the same sheet. If you notice that there are already several people in the sheet, just wait your turn before starting to edit the fields (or else, everyone will be editing at the same time and no one will get his/her right filter)!


If you want to find more: