What do I need to know about Google Analytics filters and segments?

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!

What is an advanced segment?

A segment is a subset of a population. For example, men and women are two segments of the human population. Children is 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.

How do you create an advanced segment?

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.

How do you use Google Analytics Advanced Segments 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.

 

What is a Google Analytics filter?

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.

What’s the difference between a filter and a 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 on the result that is returned.

How do you 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

What do our clients usually do with filters?

Here are 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

 

If you want to find more:

https://developers.google.com/analytics/devguides/reporting/core/dimsmets