Mailerflow Start free
Blog › AI Email Marketing › AI Email Personalization

How to Personalize Emails With Website Behavior Data

Published November 20, 2026 · Updated November 20, 2026 · 9 min read

Illustration for How to Personalize Emails With Website Behavior Data

Personalizing emails with website behavior means connecting a known contact to the pages and objects they viewed, storing that as structured data, and referencing it in the email. The mechanics are simple once you separate the two data types you're working with: profile data (fields you already hold, like plan or signup date) and behavioral data (pages viewed, objects viewed, events like downloads or video plays). Profile data tells you who someone is; behavioral data tells you what they're currently interested in. The second is what makes an email feel timely.

This is the pillar article for the Behavior-Based Personalization cluster. It covers the full path from a page view to a personalized email, with a content-site example you can adapt.

What You'll Set Up and What You Need

The core idea: a visitor browses your site, a tracking call records what they looked at against their contact record, and an email later reads that record. Nothing more exotic than that.

There's one hard constraint worth stating up front. Anonymous visitors can't be personalized, because there's no contact to attach behavior to. Identity has to arrive first — a login, a signup form, or a click from an email that carries an identifier in the link. Until that happens, you can track sessions, but you can't send a personalized email to them.

Before you start, confirm you have:

  • Identifiable contacts — a contact database where a person maps to a stable ID or email address.
  • A tracking snippet or JS SDK on your site, loaded on the pages you care about.
  • Custom fields or event properties to store behavior. You need somewhere for the data to land.
  • An email platform that can read those fields in copy, blocks, and segment rules.

If any of those are missing, fix that first. Most failed personalization projects fail at step three — behavior gets tracked but never stored in a structured field, so there's nothing to merge into an email.

Not sure your current tool is the right fit? Compare the Best Email Marketing Platforms by price, features and free plans for your exact list size.

Step-by-Step: From Page View to Personalized Email

1. Define the behavior you actually care about

Don't track everything. Pick two or three signals that map to a real email. For a content site: article views, topic, and downloads. For a SaaS product: pricing page views, feature page views, and trial starts. Write them down as a list before touching any code.

2. Install the tracking snippet or JS SDK and identify contacts

The snippet loads on every page. Identification is the part people skip: when a contact logs in or submits a form, pass their contact ID or email to the SDK. If they arrive from an email link, include the identifier in the URL and let the SDK read it on landing. From that point, page views attach to a real contact instead of an anonymous session.

3. Create the custom fields that will hold the behavior

Keep the schema small and readable. A workable set:

Field Type Example value
last_article_id text a-1042
last_article_title text Setting Up DKIM Without a Developer
last_topic text deliverability
topic_tags text (comma-separated) deliverability,automation
last_viewed_at date 2026-11-18T14:22:00Z
articles_read_30d number 7

Store the readable title, not just the URL. A merge tag that renders a raw URL reads like a database dump.

4. Map page and object views to those fields

This is a rule, not a script per page. Match on a URL pattern, a data- attribute, or an object ID passed to the SDK, then write the mapped values to the fields. A single rule like "any URL matching /blog/* writes last_article_title and last_topic" covers the whole section.

5. Build a dynamic segment from the behavior

Segments should be rules, not static lists, so they stay current. Example: contacts where last_topic equals deliverability AND last_viewed_at is within the last 14 days. Anyone who matches enters; anyone who goes quiet drops out.

6. Add a personalization step to the email or automation

In the email, pull the field into copy or a block: a heading, a recommended-reading list, or a single line of text. In an automation, the personalization step runs before the send so the value is fresh. Mailerflow's AI personalization steps and website-behavior data (JS SDK) are built for exactly this — the SDK writes behavior to the contact, and the personalization step reads it at send time.

7. Test with a known contact and verify the field updates

Browse your own site while logged in as a test contact, then open the contact record. If the fields didn't update, the problem is almost always identification (step 2), not the mapping rule.

If you'd rather describe the workflow than build it click by click, Mailerflow's AI automation builder drafts the trigger, waits, conditions, and emails from a sentence, and you review it before activation.

A Worked Example: A Content Site

A content site publishes on three topics: deliverability, automation, and copywriting. A logged-in reader, contact c-8821, reads three deliverability articles and downloads a guide. Here's the path.

The tracking call. Each article page fires an SDK call on load:

mailerflow.track('article_view', {
  contact_id: 'c-8821',
  article_id: 'a-1042',
  article_title: 'Setting Up DKIM Without a Developer',
  topic: 'deliverability'
});

The fields that get written. After the third article and the download, the contact record looks like this:

last_article_id:      a-1042
last_article_title:   Setting Up DKIM Without a Developer
last_topic:           deliverability
topic_tags:           deliverability,automation
last_viewed_at:       2026-11-18T14:22:00Z
articles_read_30d:    3
guide_downloaded:     dkim-checklist

The segment that forms. last_topic = deliverability AND articles_read_30d >= 3 AND last_viewed_at within 14 days. Contact c-8821 enters.

The email that goes out. Subject: Three more on deliverability, since you're deep in it. Body opens with:

Since you've been reading about [last_topic], here are three more pieces on it — starting with the one people ask about most.

That renders as "Since you've been reading about deliverability..." The recommended-reading block pulls from the same topic tag.

The second branch. A different contact, c-9014, views the pricing page twice in a week but never signs up. That's a separate segment (pricing_views_7d >= 2 AND plan = none), and it gets a different email: a short note with a single link to a comparison page, no recommended-reading block at all. Same tracking, different rule, different message.

The automation, in order:

  1. Trigger: contact enters the deliverability-readers segment.
  2. Wait: 1 day (so the email doesn't arrive minutes after a page view).
  3. Condition: last_viewed_at still within 14 days.
  4. Email: the personalized send above.
  5. Wait: 4 days.
  6. Condition: no click on the first email.
  7. Email: a shorter follow-up referencing the same topic.

The wait in step 2 matters more than it looks. An email that arrives ninety seconds after someone closes a tab reads as surveillance; the same email the next morning reads as service.

How to Check It Works

Run this sequence with a test contact before you trust the automation.

  1. Browse while logged in. Open three articles in one topic as your test contact.
  2. Check the contact record. Confirm last_article_title, last_topic, and last_viewed_at are populated and the timestamp is current. If they're empty, identification failed — check that the SDK received the contact ID.
  3. Check the segment. The test contact should appear in the dynamic segment within a few minutes. If it doesn't, the rule is too narrow (a typo in the topic value is the usual cause).
  4. Send a test email. Confirm the merge tag renders the real value, not the fallback. If you see the fallback text, the field name in the email doesn't match the field name in the contact record.
  5. Check the automation log. Confirm the trigger fired, the wait elapsed, and the condition evaluated as expected. A condition that blocks the send usually means the recency window is too tight.
  6. Check the event log or webhook delivery log if you're forwarding events elsewhere. Signed webhooks with retries and delivery logs make this straightforward — a failed delivery shows up rather than disappearing.

Common Mistakes and Fixes

Personalizing on anonymous data. No identity, no match, no personalization. Fix: get identification in place before you build the email.

Storing raw URLs instead of readable titles. Merge tags that output https://example.com/blog/a-1042 look broken. Fix: write the title alongside the ID.

Overwriting the last viewed object. If every page view overwrites last_article_title, the email may reference whatever the contact glanced at last, not what they care about. Fix: keep a topic_tags field that accumulates, and use the last object only as a secondary detail.

No fallback copy. Empty fields produce sentences like "Since you've been reading about , here are...". Fix: always write a fallback branch, and test it by sending to a contact with no behavior data.

Tracking too much. Twenty fields nobody uses make the contact record unreadable and the segment builder unusable. Fix: start with the fields that appear in an email.

Ignoring consent and retention. Behavioral data is personal data. Fix: collect consent where required, log it, and set a retention window so old behavior ages out. Mailerflow's GDPR tools — data export, erasure, consent logs, configurable retention, with data hosted in Europe — cover the operational side. For the editorial side, see personalization without crossing into creepiness.

Sending immediately after a page view. Fix: add a wait. A day is usually enough.

Segmenting on a single page view. One view is noise. Fix: require a pattern — two or more views, or a view plus a download.

Next Steps

Once one behavior works end to end, expand deliberately. Add topic affinity (which topics accumulate over 30 days), recency (how recently they engaged), and depth (how many articles they read in a session). Those three turn a single merge tag into a real picture of interest, and they're the inputs behind predicting purchase intent from email and website signals.

From there, layer on send-time optimization so the personalized email also lands when the contact is most active, and A/B test subject lines that reference behavior against neutral ones — the difference tells you whether the personalization is doing the work or just adding words. If you're running this at volume, controlling the cost of AI personalization at scale is worth reading before you multiply the number of personalized variants.

This article is the pillar of the Behavior-Based Personalization cluster. Supporting articles will be linked here as they're published, covering recommendation logic, intent signals, and privacy-first approaches in more depth.

When you're ready to build the email itself, you can describe it in a sentence and Mailerflow's AI email builder returns a complete responsive design with subject lines and preview text; the automation builder does the same for the workflow.

FAQ

Can I personalize emails for anonymous visitors? Not directly. You can track their session, but there's no contact record to attach it to and no address to send to. The usual pattern is to identify them first — a signup, a login, or a click from an email that carries an identifier — and personalize from the next send onward.

How long should I wait after a page view before sending? Long enough that the email doesn't feel like a reaction to a specific click. A day is a common starting point. If the behavior is a strong signal, like a pricing page visit, a few hours can work; test it rather than assuming.

What's the difference between a page view and an object view? A page view is a URL. An object view is a specific thing on that page — an article, a product, a video. Object views are more useful for personalization because they carry structured attributes (title, topic, category) you can put in an email.

Do I need a developer to set this up? For the tracking snippet and the identification call, usually yes — it's a small amount of code, but it's code. Everything after that (fields, segments, personalization steps, automations) is configuration you can do yourself.

How do I handle consent for behavioral tracking? Collect consent where your jurisdiction requires it, log it against the contact, and set a retention window so behavior data doesn't sit indefinitely. Make sure you can export and erase an individual's data on request.


Describe your next email or automation in one sentence and let Mailerflow's AI build it — free plan, no credit card.