This segment building technique includes/removes users who are in another segment.

You can use this to create audiences based on existing segments, and to create segments with nested AND clauses.

Create Segments Based on Existing Segments

To create segments based on users being in/out of existing segments, use the Segment Entry and Segment Exit events where properties.segment_number is the ID of the existing segment.

Example: ActiveSubscribers
I have an existing segment of 'ActiveSubscribers' who have paid subscription to my site. Users enter this segment but they never leave the segment, so I am only including Segment Entry events.

Viewed 3 Pages In Session OR are ActiveSubscribers

Viewed 3 Pages In Session AND are ActiveSubscribers

Viewed 3 Pages In Session OR are not ActiveSubscribers

Viewed 3 Pages In Session AND are not ActiveSubscribers

Create Segments With Nested AND Clauses

To create a segment with the logic 'User performs behaviour X and Y, or performs behaviour Z' use this segment_entry method.

  1. Create a segment of 'user performs behaviour X and Y'. Make a note of the segment ID.
  2. Create a segment of 'user enters segment (1) or performs behaviour Z'.

Example: [Tech Reader AND Highly Engaged] OR Read Sponsored Content

I am going to create a segment that includes all users who have 

  • Read at least 3 'technology' articles in their current session AND
  • Been actively engaged for at least 30s in their current session


  • Read a piece of sponsored content

First, I create a segment of users who are tech readers and are highly engaged. 

Having created the segment, it's ID (code) is 2595. Now, I create a second segment of users who have entered segment 2595 in their current session or have read sponsored content in their current session. This is my final segment.

How It Works

When a user enters a segment there is a Segment Entry event. If the user ever leaves the segment then there is a Segment Exit event. 

Stages of user journey through a segment (for that segment ID):

  1. User has never entered the segment. 0 Segment Entry events.
  2. User has entered the segment. 1 Segment Entry event and no Segment Exit event 
  3. User has exited the segment. 1 Segment Entry event and 1 Segment Exit event
  4. User re-enters the segment. 2 Segment Entry events and 1 Segment Exit events

and so on.

Note: Many time-based segments will be entered multiple times, for example a user will enter and exit 'in-session' segments every session. Make sure to set up your criteria over the same time-frame to only include relevant Segment Entry and Segment Exit events.

Did this answer your question?