In Salesforce Marketing Cloud, analyzing the performance of journeys is crucial for optimizing marketing strategies and enhancing customer engagement. One effective way to gain insights into journey performance is by querying the system’s data views using SQL. In this article, I’ll break down a SQL query designed to retrieve daily journey analytics from Salesforce Marketing Cloud.
Context
Before delving into the SQL query, let’s understand the components involved.
- Journeys: These are multi-step marketing campaigns designed to engage customers at various touchpoints.
- _Job: Represents a send job for an email within a journey.
- _Sent: Records each instance of an email being sent.
- _Open: Tracks when subscribers open emails.
- _Click: Records clicks on links within emails.
- _Bounce: Logs instances where emails bounce back undelivered.
- _Unsubscribe: Records instances where subscribers opt out of further communications.
- _JourneyActivity: Tracks activities within a journey, such as sends, opens, clicks, etc.
- _Journey: Contains information about journeys, including their status and versions.
Query breakdown
Let’s dissect the SQL query step by step:
- SELECT: This clause selects the fields we want to retrieve in the result set, including JourneyID, JourneyName, VersionNumber, Status, SentDate, EmailName, and various counts for different activities.
- FROM: Specifies the primary table from which data is retrieved, in this case, the _Job table.
- JOIN: Joins the _Job table with other relevant tables (_Sent, _Open, _Click, _Bounce, _Unsubscribe, _JourneyActivity, and _Journey) based on common keys (JobID, ListID, BatchID, SubscriberID).
- WHERE: Filters the data based on specific conditions:
- Retrieves only journeys with non-null names that are either running or paused.
- Filters data for a specific date (five days ago from the current date).
- GROUP BY: Groups the results by JourneyID, JourneyName, VersionNumber, EmailName, SentDate, and Status, allowing aggregation functions (COUNT) to be applied to calculate metrics for each group.
Understanding the metrics
- Sent: Total number of emails sent.
- Delivered: Number of sent messages that were successfully delivered.
- Opened: Count of emails that were opened by recipients.
- Clicked: Number of clicks on links within emails.
- Bounced: Instances where emails bounced back undelivered.
- Unsubscribed: Count of subscribers who opted out of further communications.
Conclusion
This SQL query provides valuable insights into the performance of journeys within Salesforce Marketing Cloud. By analyzing metrics such as sends, opens, clicks, bounces, and unsubscribes on a daily basis, marketers can assess the effectiveness of their campaigns, identify areas for improvement, and tailor future strategies to better engage their audience.
Understanding and leveraging journey analytics is essential for optimizing marketing efforts, enhancing customer experiences, and driving overall business success in Salesforce Marketing Cloud.