Be aware of “doesn’t” in Analytics Segments.

Advanced Segments is one of the most powerful features of Google Analytics. This tool allows you to slice your data with great precision and narrow your marketing decisions. Advanced Segments lets you to separate data according to custom filters set upon any metrics or dimensions and combined by logical operators. But sometimes getting along with conditions can be tricky and requires deeper understanding of how Google Analytics processes your website data. Scopes of dimensions and combinations of conditions generate most difficulties, as they can be ambiguous. Consider the following example:

After reaching your website, a visitor can download an e-book, enter a promotional code for an extended trial, or just sign up for a regular trial. Each action is tracked in Google Analytics with the corresponding event:

'eventCategory': 'Promotion',
'eventAction': "E-book Download",
'eventLabel': '[e-book titile]'
'eventCategory': 'Coupon',
'eventAction': 'Extended Trial',
'eventLabel': '[campaign title]'
'eventCategory': 'Sign-up',
'eventAction': 'Trial Sign-up',
'eventLabel': '[Product Label]'

We want to know how many users a) just downloaded an e-book and signed up, b) just used a promo code and signed-up, c) downloaded an e-book,used a promo code, and eventually signed up.

Intuitively, Advanced Segments with event action and event category conditions will do the work:

Segment with two conditions combined with AND operator

This segment will include sessions in which a) an e-book was downloaded and sign-up events have happened.

However, it will also include users from the segment c) when users both downloaded an e-book, used a promo code, and signed-up . Hopefully, there is ‘doesn’t contain’ conditions in the filter dropdown. One would think that to solve this issue it is enough to add one more condition for the event category, namely not to contain the ‘Extended Trial’ action.

Segment with ‘doesn’t contain’ conditions

However, this will not work. In fact, the condition ‘doesn’t contain pattern’ matches all the events that do not contain pattern value, including the event action “E-book Download.” And that’s where scopes get into the action. Event actions are a “hit-level” dimension there can be multiple events with different actions within one session. So, if a session has an event action to pass condition one and an action to pass condition two — it will be included in this filter. Support pages are not precise clear about this nuance:

Different ANDs for users and sessions

Here is an example from a real account and a button click event:

One condition
The same condition combined with ‘doesn’t contain’

This could lead to some mindblowing combinations:

How do you like that?

The way to handle these situations is to use multiple filters instead of conditions. The a) and b) segments should be constructed as a combination of include and exclude filters. The c) filter will be ok with three AND conditions:

Fix the things with the ‘Exclude’ filter

Similar to the events, page dimensions in segments are also affected by “any combination” processing, since they are also hit-scope dimensions and “doesn’t contain/match” will work the same for pages.

Remember that, as support page states this logic doesn’t apply to segmenting users and requires that all the conditions must match all the combinations.

Happy analyzing!

Like what you read? Give Dmytro Bulakh a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.