Sub topic 10
Consent, Privacy and Data Minimisation
This chapter assumes you can insert merge tags with fallbacks, write basic Liquid-style conditionals, and know what a contact field is. It covers what you are allowed to personalise with, what you should choose not to, and how to build those limits into templates and data pipelines. Syntax is Liquid-style. Field names and consent mechanics vary by platform.
Why personalisation raises privacy questions
Every merge tag reads a stored fact about a person. Each fact was collected for some reason, under some terms, and is now being shown back to the person, and possibly to others who can see their screen or inbox. Personalisation can fail legally and socially even when the template renders perfectly.
Three questions apply to every field you use:
- Did the person agree to, or reasonably expect, this use of the data?
- Do you need this field to achieve the purpose of the email?
- What happens if the wrong person sees the rendered email?
Consent and other lawful bases
Under laws such as the EU and UK GDPR, you need a lawful basis for processing personal data. Two bases come up most often in email marketing:
- Consent. The person opted in, clearly and specifically, and can withdraw as easily as they gave it.
- Legitimate interest. You have a business reason that does not override the person's rights, and you have documented a balancing test. In the EU and UK, separate e-privacy rules often still require consent for marketing email to individuals. Some exceptions exist for existing customers.
Other regions work differently. CAN-SPAM in the US is mainly about honest headers, a postal address, and a working unsubscribe. CASL in Canada requires express or implied consent. Treat the table below as a map of questions to ask, not legal advice.
| Question | Why it matters for personalisation |
|---|---|
| Is consent recorded with a timestamp and source? | You need evidence if a subscriber or regulator asks. |
| Was consent given for marketing email specifically? | Consent for order updates does not cover promotional personalisation. |
| Does the privacy notice mention profiling or behavioural tracking? | Using browsing data for content selection is usually profiling. |
| Can the person withdraw consent in one step? | Withdrawal must flow back to every system that sends. |
Transactional versus marketing messages
A receipt or password reset is a transactional message. It is triggered by something the person did and carries information they need. Marketing messages promote something. Rules for the two differ in most jurisdictions, and so does the acceptable level of personalisation.
A common mistake is slipping promotional blocks into a transactional template, such as a "recommended for you" panel under an order confirmation. Doing so can turn the whole message into marketing in the eyes of the law, and it may then be sent to someone who unsubscribed. Keep the two streams separate in your platform, and keep behavioural recommendation blocks out of transactional templates unless the person has consented.
Data minimisation
Data minimisation means collecting and using only what you need for a stated purpose. For personalisation, apply it at three points.
Collection. Do not add a signup field because it might be useful someday. Ask for birthday only if a birthday email is planned, and consider asking for the month and day only.
Use. A field in your contact database is not automatically fair game for a template. If someone gave you their job title to register for a webinar, using it to tailor sales content may be outside what they expected. This is called purpose limitation.
Exposure. Every merged value can leak. Subject lines and preheaders appear on lock screens, in notification banners, and in shared or delegated inboxes. A subject such as Sam, your debt consolidation application needs attention reveals something sensitive to anyone glancing at the phone.
Fields to avoid or handle with extra care
- Special category data under GDPR: health, religion, ethnicity, sexual orientation, political opinions, trade union membership, biometric and genetic data.
- Financial hardship, immigration status, and anything tied to children.
- Inferred attributes, such as guessing pregnancy from purchases. Inferences are personal data too, and they can feel invasive even when accurate.
- Full dates of birth, full addresses, or account numbers in the body. Use the minimum, such as the last four digits.
Building consent into the template
Template logic can check a consent flag before showing behaviour-driven content. This depends on your platform exposing the flag as a field. Here customer.consent_personalisation is an assumed boolean.
{% if customer.consent_personalisation == true and customer.last_viewed_category != blank %}
Still thinking about {{ customer.last_viewed_category }}? Here are some picks.
{% else %}
See what is new this week.
{% endif %}Notes on this pattern:
- Test the flag explicitly. A missing field is neither true nor false, and many engines treat a missing value as falsy. Spell out
== trueso the intent is clear and the default is the privacy-safe branch. - The
elsebranch is a complete, useful email, not an apology. Non-consenting contacts should get a good experience. - Combine the consent check with a presence check, so you do not render an empty string into a sentence.
Prefer to decide at the segment level when you can. A segment of "consented to behavioural personalisation" is easier to audit than a flag checked inside forty templates. Use template-level checks as a second line of defence, not the only one.
Enforcing minimisation in the data layer
If your emails are rendered by your own code, for example through an API or a Jinja2 pipeline, send the renderer only what the template needs. An allowlist stops a later schema change from leaking new columns into an email.
from jinja2 import Environment, StrictUndefined
ALLOWED_FIELDS = {"first_name", "plan"}
BEHAVIOURAL_FIELDS = {"last_viewed_category"}
def build_merge_data(contact: dict) -> dict:
"""Return only the fields a template may use for this contact."""
allowed = set(ALLOWED_FIELDS)
if contact.get("consent_personalisation") is True:
allowed |= BEHAVIOURAL_FIELDS
return {key: contact[key] for key in allowed if key in contact}
env = Environment(undefined=StrictUndefined)
template = env.from_string(
"Hi {{ first_name | default('there', true) }}."
"{% if last_viewed_category is defined %}"
" Still thinking about {{ last_viewed_category }}?"
"{% endif %}"
)
contact = {
"first_name": "Sam",
"plan": "pro",
"health_note": "should never be merged",
"last_viewed_category": "running shoes",
"consent_personalisation": False,
}
print(template.render(**build_merge_data(contact)))This prints Hi Sam. because consent is False, so the behavioural field never reaches the template. Setting consent_personalisation to True adds the second sentence. The health_note field is dropped either way. Because the check lives in one function, you can unit test it.
The decision flow
Behavioural data and tracking limits
Opens, clicks, and site events are the raw material for behavioural personalisation, and they are less reliable than they look. Mail clients such as Apple Mail with Mail Privacy Protection preload images, which makes opens appear for people who never read the message. Link scanners can register clicks that no human made. Do not build a branch like "if opened last email, show offer A" and treat it as a fact about the person.
Where you do use behaviour:
- Record the consent or notice under which the tracking happens, and honour opt-outs from tracking separately from opt-outs from email.
- Set a retention period for event data. Browsing events from three years ago rarely justify a "we noticed you looking at…" message.
- Prefer coarse signals, such as a product category, over precise ones, such as an exact page and timestamp.
Rights requests, deletion and suppression
People can ask what you hold, ask for correction, and ask for deletion. Personalisation systems tend to spread data across the email platform, the CRM, the data warehouse, and the analytics tool. Plan for this:
- Keep a list of every system that stores contact fields used in templates.
- When someone unsubscribes, add them to a suppression list that persists even if you delete the rest of their record. Otherwise a re-import can resubscribe them.
- Make sure deletion propagates. A field corrected in the CRM but stale in the email platform means personalised email with the old, wrong value.
- Check your platform's data-processing terms and where it stores data, since a vendor processing data on your behalf is a processor and needs a contract.
Common errors
- Merging a consent-gated field in a template that bypasses the segment rules, for example a copied template used for a different audience.
- Treating a missing consent field as consent.
- Putting sensitive context in the subject line, where it is visible without opening the email.
- Importing a purchased or scraped list and personalising it as if the people had a relationship with you.
- Leaving test data with real personal details in shared sample contacts. Use fictional data for previews.
Exercise
A template shows {{ customer.last_viewed_category }} in the first line for all contacts. Name two privacy problems with this, and describe one change that fixes each.
Show answer
First, the field is behavioural and is used without checking consent, so contacts who did not agree to behavioural personalisation see it. Fix it by wrapping the line in a check such as {% if customer.consent_personalisation == true and customer.last_viewed_category != blank %} and providing a generic else branch. Second, the line has no fallback or presence check, so contacts with no browsing history get a broken sentence, and a revealing category could be exposed in the first line of the preview text. Fix it by checking that the value is present and by keeping the category out of the subject and preheader unless the contact has consented and the category is not sensitive.
Exercise
Why is an allowlist of fields passed to the renderer safer than passing the whole contact record, even if the template only references two fields?
Show answer
The template can change, or be copied and edited, without anyone reviewing which columns it reads. If the whole record is available, a new reference to a sensitive or consent-gated field works immediately. An allowlist limits exposure to approved fields, makes consent logic easy to test in one place, and means a new database column is not usable in email until someone adds it deliberately.