Segments and filters in Google Analytics are one of the most powerful features to isolate the perfect amount of data needed to answer the questions about your website. Pulling data into ChannelMix can utilize the same segments and filters that you build in the Google Analytics user interface and this article is here to help you make sure you're able to configure everything correctly when setting up your ChannelMix Profile.
The Difference Between Filters and Segments
Step one is knowing if you need to use a filter or a segment. They will produce VERY DIFFERENT RESULTS so it's important to understand the differences.
Filters will include or exclude specific interactions that happen during a users session; not the whole session.
Segments will include or exclude the entire session (or user).
Here is a Google Analytics help center article that covers the differences between filters and segments with more details.
As a best practice, it's best to setup your Google Analytics Views with all the proper filters needed so that data matches the user interface and ChannelMix. If there is an instance where you're filters weren't accurate, you don't control the filters in GA, or you just need to do some spot analysis; then ChannelMix can help.
Let's say that you have your Google Analytics setup to track your website and your website consists of two hostnames (or domains); www.app.channelmix.com and www.help.channelmix.com. If you don't have individual views in Google Analytics and wanted to only see interactions from www.help.channelmix.com then you could do that with a filter like this:
The possiblilites are endless but the filter syntax used in ChannelMix always follows the form:
ga:name operator expression
In this syntax:
- name — the name of the dimension or metric to filter on. For example:
ga:pageviewsfilters on the pageviews metric.
- operator — defines the type of filter match to use. Operators are specific to either dimensions or metrics.
- expression — states the values to be included in or excluded from the results. Expressions use regular expression syntax.
As a start, if you don't know what a segment in Google Analytics is then everything you need to know about segments can be found in the Google Analytics help center documentation about segments.
Using Segments in ChannelMix
A segment can be applied to your data in ChannelMix by adding the segment ID or the proper segment syntax in the ChannelMix Profile connection details.
If you want to use the go the route of writing your own segment using the segment syntax then you'll need to brush up on the Google Analytics documentation. It's fun for some light reading but don't worry, there are other ways to get your segment into ChannelMix without using a bunch of code. Here is an example of a segment that is set to include sessions that included going to the "about-us" section of the website.
Using the Segment ID in ChannelMix
For most users, it is easier to build the segment that you want in the Google Analytics user interface and use the segment ID in ChannelMix. After you build your segment, you can retrieve the segment from the URL. Here is an example of how to decipher the Google Analytics IDs from the URL.
Account ID: 3188194
Property ID: 189140393
View ID: 185566188
Segment ID: 6fPnPPNtSmmY15Xp5osvxg
The segment ID that is found at the end of the URL string when your segment is applied, can be used in your ChannelMix Profile segment value by formatting the ID like this:
Note: Once the segment is created, click into one of the reports, apply the segment, and then copy the id out of the URL. Or double check through the Google Analytics Query Explorer Tool.