Examples of queries query-examples
This section lists several commonly used examples to query Journey Step Events in Data Lake.
Make sure that the fields used in your queries have associated values in the corresponding schema.
- id: unique for all the step event entries. Two different step events cannot have the same id.
- instanceId: instanceID is the same for all the step events associated to a profile within a journey execution. If a profile reenters the journey, a different instanceId will be used. This new instanceId will be same for all the step events of the reentered instance (from start to end).
- profileID: the profile鈥檚 identity corosponding to the journey namespace.
note note |
---|
NOTE |
For troubleshooting purposes, we recommend using journeyVersionID instead of journeyVersionName when querying journeys. Learn more about journey properties attributes in this section. |
Basic use cases/common queries common-queries
accordion | ||
---|---|---|
How many profiles entered a journey in a certain time frame | ||
This query gives the number of distinct profiles that entered the given journey in the given time frame. Data Lake query
|
Example
code language-sql |
---|
|
Data Lake query
code language-sql |
---|
|
Data Lake query
code language-sql |
---|
|
Data Lake query
This query returns all the step events and service events for the given profile and journey for the specified time in chronological order.
code language-sql |
---|
|
These queries can be used, for example, to estimate the time spent in a wait activity. This allows you to make sure that the wait activity is correctly configured.
Data Lake query
code language-sql |
---|
|
Data Lake query
code language-sql |
---|
|
The Journey Step Events dataset contains all the stepEvents and serviceEvents. stepEvents are used in reporting, as they relate to activities (event, actions, etc.) of profiles in a journey. serviceEvents are stored in the same dataset, and they indicate additional information for debugging purposes, for example the reason for an experiance event discard.
Here is an example of query to check the detail of a serviceEvent:
Data Lake query
code language-sql |
---|
|
Message/Action Errors message-action-errors
accordion | ||||
---|---|---|---|---|
List of each error encountered in journeys | ||||
This query allows you to list each error encountered in journeys while executing a message/action. Data Lake query
Example
This query returns all the different errors that occurred while executing an action in a journey along with the count of how many times it occurred. |
Profile-based queries profile-based-queries
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
The result should be greater than 0. This query returns the exact number of times a profile has entered a journey.
Method 1: if the name of your message is not unique in the journey (it is used at multiple places).
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
The result should be greater than 0. This query only tells us whether the message action was successfully executed on the journey side.
Method 2: if the name of your message is unique in the journey.
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
The query returns the list of all messages along with their count invoked for the selected profile.
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
The query returns the list of all messages along with their count invoked for the selected profile.
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
The query returns the list of all journey names along with the number of times the queried profile entered the journey.
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
The query returns, for the defined period, the number of profiles that entered the journey each day. If a profile entered via multiple identities, it will be counted twice. If reentrance is enabled, profile count might be duplicated across different days if it reentered the journey on different day.
Queries related to the Read Audience read-segment-queries
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
The query returns the time difference, in minutes, between when time the audience export job was queued and when it finally ended.
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
The query returns all the profile Ids that were discarded by the journey because they were duplicates.
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
The query returns all the profile Ids that were discarded by the journey because they had an invalid namespace or no identity for that namespace.
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
The query returns all the profile Ids that were discarded by the journey because the identity map was missing.
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
The query returns all the profile Ids that were discarded by the journey beacause the export job was run in test mode but the profile did not have the testProfile attribute set to true.
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
The query returns all the profile Ids that were discarded by the journey due to some internal error.
Data Lake query
code language-sql |
---|
|
It will return all service events related to the given journey version. We can follow the chain of operations:
- topic creation
- export job creation
- export job termination (with metrics on exported profiles)
- worker processing termination
We can also detect issues such as:
- errors in topic or export job creation (including timeouts on audience export API calls)
- export jobs which can be stuck (case when for a given journey version, we don鈥檛 have any event regarding the export job termination)
- worker issues, if we have received export job termination event but no worker processing termination one
IMPORTANT: if there is no event returned by this query, it may be due to one of the following reasons:
- the journey version has not reached the schedule
- if the journey version is supposed to have trigger the export job by calling the orchestrator, something went wrong on the upstram flow: issue on journey deployment, business event or issue with scheduler.
Data Lake query
code language-sql |
---|
|
Data Lake query
code language-sql |
---|
|
If no record is returned, that means that either:
- an error has occured during topic or export job creation
- the export job is still running
Data Lake query
code language-sql |
---|
|
Data Lake query
code language-sql |
---|
|
This query is different than the previous one.
It returns the overall metrics for a given journey version, regardless the jobs which can have run for it (in case of recurring journeys, business events triggered ones leveraging topic reuse).
Queries related to Audience Qualification segment-qualification-queries
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
This query returns all the profile Ids that were discarded by the journey version due to wrong audience realization.
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
This query returns all events (external events / audience qualification events) that were discarded because of any other reason for a profile.
Event-based queries event-based-queries
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
Common journey-based queries journey-based-queries
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
The query returns, for the defined period, the count of unique journeys that triggered each day. A single journey triggering on multiple days will be counted once per day.
Queries on journey instances journey-instances-queries
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|
Data Lake query
code language-sql |
---|
|
Example
code language-sql |
---|
|