Example Queries

Journeys History queries you can copy and tweak to your purposes

Warnings and Considerations

When querying journey history across versions:

  • step_id is not stable across journey versions. All step_id’s will change between versions.
  • step_name is always unique within a journey version (whether it changes or not between versions depends on whether the user modifies it).

Joining journey history data to other data sources:
operation_id is available in personalization (using simon.operation_id in Jinja). This makes it useful to join to other data sources, such as engagement events.

Journey history events by email

// Journey history events with email
select i.email,cjh.*
from contact_journey_history cjh
left join identity_customer__latest i
on i.simon_id = cjh.simon_id
where journey_id = 27923 
order by entry_id desc, timestamp asc;

Query for metadata

// Querying for metadata
select metadata:promo_id, count(*) 
from contact_journey_history 
where metadata:promo_id is not null
group by metadata:promo_id;

All history for a specific Journey

select *
from contact_journey_history
where journey_id = JOURNEY ID HERE //You can find this Journey Id
order by entry_id, timestamp asc; // ordered by the time