Consent categories aren't available as direct customer attribute references in Jinja. To use consent data in email content, choose a segmentation, aggregate, or trigger-event approach based on what the email needs to evaluate.
Choose the right approach
Use a segmentation to show content to a customer based on their current consent-based audience.
Use an aggregate to evaluate the customer's latest relevant consent action or event history.
Use trigger-event data to show content based on the consent event that triggered the email.
Prepare combined data before sending when a single email needs to display content for several newly accepted categories.
Use a segmentation for the current consent status
Create a segmentation based on the customer's consent category, then reference the segmentation in Jinja:
{{ segmentations['SEGMENTATION_ID'] }}Use this approach when the email only needs to distinguish customers by their current consent-based segment, such as those with Marketing consent.
Create the segmentation
Create a segmentation for the required consent condition.
Include customers who match the relevant consent category.
Copy the segmentation ID.
Reference the segmentation value in the email with Jinja.
Segmentation is usually the simplest option when you don't need to know when consent was granted or whether it was newly granted.
Use an aggregate for consent event history
Use an aggregate when the email needs to evaluate a customer's consent event history. For example, create a Last customer aggregate with these settings:
Event:
consentAttribute:
actionFilter:
category = YOUR_CONSENT_CATEGORYValidity: Configure the aggregate to account for the consent event's
valid_untilvalue when applicable.
Reference the aggregate in Jinja:
{% if aggregates['AGGREGATE_ID'] == 'accept' %}
<!-- Content for customers with an accepted consent event -->
{% else %}
<!-- Alternative content -->
{% endif %}This approach evaluates the latest relevant consent action. It helps when the email needs event history rather than only the customer's current consent-based audience.
Use trigger-event data for consent-triggered emails
If a consent event triggers the email, access the event data directly in Jinja. A consent event contains one category value. To show a content block only when the trigger event belongs to a specific category, use a row display condition:
{% if event.category == 'Marketing' %}
<!-- Content for the Marketing category -->
{% endif %}Use this approach when one email template contains multiple consent-specific modules:
{% if event.category == 'Marketing' %}
<!-- Marketing module -->
{% endif %}
{% if event.category == 'Other' %}
<!-- Other module -->
{% endif %}Trigger-event data represents only the event that triggered the email. It doesn't provide the customer's complete consent history or identify which categories were newly accepted compared with the previous state.
Handle multiple categories accepted at once
A single consent event contains one category value. When a customer accepts multiple categories, the platform typically creates separate consent events, one for each category. A consent-triggered scenario runs separately for each event and doesn't automatically combine all selected categories into a single email.
Choose the approach that matches the required email behavior.
Create separate flows and templates
Create one flow for each consent category. Trigger each flow when:
The event is a consent event.
actionisaccept.categorymatches the relevant category.
This approach sends a separate email for each accepted category.
Use one flow with Jinja conditions
Use one flow and show or hide email rows based on the trigger event:
{% if event.category == 'Marketing' %}
<!-- Marketing module -->
{% endif %}Repeat the condition for each module. This approach reduces the number of templates you maintain, but each email execution still corresponds to a single consent event and a single category.
Prepare the combined data before sending
If the requirement is to send a single email containing multiple newly accepted categories, create a custom event or customer attribute to store the combined category information before the email is triggered. Jinja can then use that prepared data to decide which modules to display.
Select the right approach for your use case
Requirement | Recommended approach |
|---|---|
Show content based on a customer's current consent-based audience | Segmentation |
Evaluate the latest relevant consent action | Aggregate |
Show content based on the event that triggered the email | Trigger-event data |
Show only categories newly accepted in a submission | Prepare the data before sending |
Send a separate email for each accepted category | Separate consent-triggered flows |
Send one email for multiple accepted categories | Create a combined event or attribute before triggering |