Engagement Splits in Journey Builder using AMPscript
Engagement Splits allow you to route contacts based on how they interact with emails, such as opens, clicks, or conversions. However, sometimes you may want more advanced logic using AMPscript to define custom engagement criteria.
Using AMPscript with Engagement Splits
While Engagement Splits in Journey Builder work based on tracking events, AMPscript can help capture and store additional engagement data, which can then be used for decision-making.
1.Storing Engagement Data with AMPscript
You can use AMPscript in emails to log user engagement data into Data Extensions (DEs). This helps in cases where:
- You need to track clicks on specific links instead of all clicks.
- You want to record additional metadata (e.g., timestamp, campaign ID).
- You need custom logic before deciding engagement.
Example: Capture Clicks on a Specific Link
SET @SubscriberKey = _SubscriberKey
SET @EmailName = “WelcomeEmail”
SET @LinkClicked = RequestParameter(“URL”)
IF NOT EMPTY(@LinkClicked) THEN
INSERTDE(“EngagementTrackingDE”, “SubscriberKey”, @SubscriberKey, “EmailName”, @EmailName, “ClickedURL”, @LinkClicked, “ClickDate”, NOW())
ENDIF
- This script captures engagement and logs it into a Data Extension (DE) named “EngagementTrackingDE”.
- The data can be used later in Journey Builder Decision Splits.
2.Using AMPscript Data in Engagement Splits
Once you’ve stored engagement data in a Data Extension, you can use it in Journey Builder:
- Add a Data Extension Entry Event
- Ensure your journey starts with a DE that contains subscriber engagement data.
- Use a Decision Split Instead of Engagement Split
- Since AMPscript stores engagement data in a DE, use a Decision Split with a lookup function instead of a standard Engagement Split.
Example: Decision Split Checking Engagement Data
- In the Decision Split, use the condition:
“ClickedURL” IS NOT NULL
(assuming “ClickedURL” is a field in EngagementTrackingDE) - If using SQL for more advanced segmentation, you could query engaged users:
- SELECT SubscriberKey
- FROM EngagementTrackingDE
- WHERE ClickDate > DATEADD(DAY, -7, GETDATE())
3.Alternative: Using AMPscript in Cloud Pages for More Flexibility
If you need real-time tracking outside of email links, you can use Cloud Pages with AMPscript to track user interactions and update DEs accordingly.
Key Takeaways
Engagement Splits work for standard interactions, but AMPscript allows custom engagement tracking.
AMPscript stores user interactions in a Data Extension, which can be referenced in Decision Splits.
Use Decision Splits with DE data instead of standard Engagement Splits for more advanced logic.
SQL Queries or Cloud Pages can further enhance tracking and segmentation.