To create segments based on experiences, experiments or audience syncs you can use TRACKING events.
TRACKING events are events that are automatically stored against a guest when an experience/experiment/audience sync executes for that guest. For example if a guest is sent an abandoned cart email, a tracking event will be stored against that guest with details of the execution.
To segment using the TRACKING event you can search for the tracking event when creating a basic segment using the Batch Segmentation UI. The data available for TRACKING events in basic mode of Batch Segmentation is limited, so you can use the following SQL to segment for guests that have been exposed to a particular experience.
Advanced Segment SQL for segmenting by experience ref:
SELECT g.meta_ref as guest_ref
FROM sessions s
INNER JOIN (
WHERE upper(type) = 'TRACKING'
AND flow_execution_flow_ref = '<<ref>>'
ON e.meta_session_ref = s.meta_ref
INNER JOIN guests g
ON s.meta_guest_ref = g.meta_ref
GROUP BY g.meta_ref
The experience ref can be found in the URL of the experience:
Please note that if you want to segment based on guests that have been exported as part of an audience sync, you must must enable tracking on the audience sync when you are setting it up.
After enabling tracking, tracking events will start being automatically stored against guests every time the audience sync executes. These tracking events are what we are using in above SQL to segment our guests.
For audience sync the ref can be retrieved from the URL in the same way as for experiences described above.