How to Segment by Website Behavior and Interests (Step-by-Step) (2026)
To segment by website behavior, you need two things working together: a way to recognize a known contact on your site, and a place to store what they did. Anonymous page views can't be segmented — you only get behavior data for people you can identify, whether that's through a logged-in session, a tracked link, or a form submission. Once identification is in place, you map page views to topics, score those topics over time, and build dynamic segments that update themselves as people browse.
This guide walks through the full setup: the data you need, the exact steps, a worked example, and how to verify the segments actually behave the way you expect.
What you'll set up and what you need
The core idea is simple. A contact visits three pages about pricing and one about integrations. You record those page categories against their profile, score the topics, and the next time you send a campaign, that contact lands in the pricing segment instead of a generic newsletter list.
There are two levels of signal here, and it helps to keep them separate:
- Page-level signals are the raw events: this URL was viewed by this contact at this time. Useful for triggering automations and for recency rules.
- Topic-level signals are the aggregated interpretation: this contact has shown pricing interest three times in the last month. This is what interest based segmentation is built from, and it's what you actually send against.
Before you start, you need three things:
- A way to identify contacts on your site. Either a JavaScript snippet that passes a contact identifier on page view, or a form that captures the identifier when someone submits it. Mailerflow's embeddable signup forms support double opt-in and consent records, so the consent trail is attached to the contact from the first interaction.
- Three to six topic buckets you genuinely send about. Not twelve. If you can't write a distinct email for a topic, it shouldn't be a segment. Common buckets: pricing, onboarding, integrations, security, templates, industry-specific content.
- A place to store the signal. Custom fields for scores, tags for binary membership, or events for the raw activity. Most setups use a mix: events for the raw page views, a numeric field for the score, and a tag when the score crosses a threshold.
If you're new to segmentation generally, it's worth reading up on how to segment new vs long-time subscribers first, because behavior segments work best when they sit alongside lifecycle segments rather than replacing them.
Step-by-step: from page views to interest segments
1. Install the tracking snippet site-wide
Add the JavaScript SDK snippet to your site's global template so it fires on every page, not just the ones you care about. Firing only on selected pages means you lose the context of what people didn't visit, which matters for exclusion rules later.
Setting to change: paste the snippet before the closing </body> tag, or load it through your tag manager.
Verify it: open your activity log and load a page in an incognito window. You should see a page view event arrive within a few seconds. If nothing arrives, check for a content security policy blocking the script.
2. Decide your topic taxonomy and map URLs to it
Write down your topics, then map URL patterns to each one. Be specific about patterns so /pricing/enterprise and /pricing both match, but /blog/pricing-psychology doesn't accidentally land in the same bucket if you don't want it to.
Setting to change: in your page category or event rules, add a pattern per topic.
Verify it: visit one URL from each pattern and confirm the event lands with the correct category label, not uncategorized.
3. Identify known contacts
This is the step people skip, and it's the one that breaks everything. Pass a contact identifier on page view — typically an email hash or contact ID — when someone is logged in or arrives from a tracked link. For everyone else, capture the identifier through a form.
Setting to change: in the snippet configuration, set the identity parameter to read from your session or cookie. In your form settings, enable double opt-in and consent recording so the signup is lawful and logged.
Verify it: submit your own form, confirm the contact appears in your list with a consent record, then browse two pages and check that the page views attach to that contact rather than to an anonymous session.
4. Create the score fields and tags
For each topic, create a numeric custom field, for example topic_pricing_score, and a tag like interest_pricing.
Setting to change: in custom fields, add a number field per topic. In tags, create one per topic with a consistent naming convention.
Verify it: open a test contact's profile and confirm the fields exist and show as empty rather than missing.
5. Build a dynamic segment per topic
Now combine the signals. A dynamic segment recalculates membership automatically, so you never maintain it by hand.
Setting to change: create a segment with conditions on the score field, the tag, and the event. For example: topic_pricing_score is greater than or equal to 2, AND has tag interest_pricing, AND viewed page category pricing at least once.
Verify it: the segment preview should show a count. If it shows zero and you know a test contact qualifies, check the condition logic — an AND where you meant OR is the usual culprit.
6. Add a recency rule so interest decays
Interest isn't permanent. Someone who researched pricing six months ago and never returned shouldn't keep receiving pricing emails.
Setting to change: add a time condition, for example viewed page category pricing in the last 30 days.
Verify it: check the segment size before and after adding the rule. It should shrink. If it doesn't, your event timestamps aren't being recorded correctly.
7. Optionally draft the segment with AI
If you'd rather describe the segment than click through conditions, Mailerflow's AI segmentation takes a plain-language description — something like "contacts who viewed pricing pages at least twice in the last month and aren't in an active trial" — and drafts the conditions for you. Review what it produced before saving, particularly the time windows.
8. Attach the segment to a campaign or automation
A segment that isn't used is just a report. Send to it, or use it as a trigger condition in an automation.
Setting to change: in the campaign recipient step, select the segment instead of the full list. In automations, add the segment as an entry condition.
Verify it: send a test campaign to the segment only and confirm the recipient count matches the segment preview.
A worked example: a B2B scheduling tool
The following is an illustrative example, not a real customer.
A scheduling SaaS has four topics: pricing, integrations, security, and templates. Their URL mapping looks like this:
| Topic | URL pattern | Score field |
|---|---|---|
| Pricing | /pricing*, /compare* |
topic_pricing_score |
| Integrations | /integrations*, /apps/* |
topic_integrations_score |
| Security | /security*, /trust* |
topic_security_score |
| Templates | /templates*, /examples* |
topic_templates_score |
Their "Pricing intent, warm" segment uses these conditions:
topic_pricing_scoreis greater than or equal to 2- viewed page category
pricingwithin the last 30 days - is NOT in segment
Active trial
That last exclusion matters. Trial users already get onboarding emails, and sending them a comparison email creates a confusing double message.
Now follow one contact. On day one, they view /pricing — score becomes 1, no tag yet. On day four, they view /compare/vs-competitor — score becomes 2, tag interest_pricing is applied, and they enter the segment. On day nine, they view /integrations/slack — integrations score becomes 1, but pricing score stays at 2, so they remain in the pricing segment and now also qualify for a connector guide.
What each segment receives:
- Pricing intent gets a comparison email with a plan breakdown.
- Integrations intent gets a connector guide with setup steps.
- Security intent gets a compliance overview.
If you want the email body itself to reflect what the contact read, Mailerflow's AI personalization steps can pull from website-behavior data collected by the JS SDK to tailor the content to the specific pages someone viewed.
How to check it works
Verification is a five-minute job if you do it deliberately:
- Use a test contact you control. Visit three tagged pages in one session.
- Wait for the events to land — usually seconds, but check the activity log rather than assuming.
- Open the contact profile and confirm the score field incremented and the tag applied.
- Check segment membership. Note the segment size before and after your visit; it should increase by exactly one.
- Send a test campaign to the segment only and confirm your test contact is included and a non-qualifying contact is not.
- Watch the first week for false positives. Internal traffic, bots, and your own team browsing will inflate scores. Add an exclusion for internal IPs or a tag for staff contacts.
Finally, compare performance. Mailerflow's analytics cover delivery, bounces, complaints, clicks, and approximate opens per campaign, so you can hold the segment send against your previous full-list send and see whether the smaller group actually performed differently.
Common mistakes and fixes
Tracking anonymous visitors and expecting segments to fill. Segments only populate for identified contacts. Fix it by identifying first — logged-in sessions, tracked links, or a form — and treating anonymous page views as context, not as segment data.
Treating one page view as intent. A single visit is curiosity, not interest. Require a threshold, typically two or more views of the same topic within a window, before applying the tag.
No recency rule. Without one, old interest never expires and your segments slowly fill with stale contacts. Add a 30- or 60-day window and let membership drop naturally.
Overlapping segments causing double sends. If someone qualifies for both pricing and integrations, they may get two emails in a day. Fix it with exclusion conditions or a priority order in your automation.
Collecting behavior without a lawful basis. Behavior tracking is personal data. Use consent records, configure retention so old events are deleted, and make sure you can export or erase a contact on request. Mailerflow's GDPR tools cover data export, erasure, consent logs, and configurable retention, with data hosted in Europe.
Over-segmenting into groups too small to send to. A segment of 40 contacts isn't worth a campaign. Merge topics until each segment can support a send, and split later when the list grows.
Next steps
Once behavior segments are running, layer in a second signal. Email clicks confirm interest that page views only suggest, so a contact who viewed pricing twice and clicked a pricing link is a much stronger signal than either alone.
From there, three practical moves:
- Use "send when the contact is most active" in automations so these segments get their emails at the right time.
- A/B test subject lines within each interest segment, since what works for pricing intent may not work for integrations intent.
- Build a re-engagement automation for contacts whose interest score has gone cold — say, no topic activity in 90 days.
Mailerflow's dynamic segments, automations, and REST API with scoped keys and a JS SDK cover this whole workflow. Paid plans include unlimited emails, and there's a Free plan with 2,500 contacts and 10,000 emails a month if you want to test the setup before committing. You can review the full feature set on the Mailerflow features page.
FAQ
Can I segment visitors who aren't in my list yet? Not as contacts, because a segment is a group of contacts. You can track anonymous page views for analytics, but the moment you want to email someone based on behavior, they need to be identified. The practical path is to capture the identifier through a form, then let their subsequent browsing build the profile.
How many page views should count as interest? Two views of the same topic within a 30-day window is a reasonable starting threshold — it filters out accidental clicks without being so strict that segments never fill. Adjust based on how much traffic your site gets and how many topics you're tracking.
Do I need a developer? For the initial snippet installation, usually yes, or someone comfortable with a tag manager. After that, building segments, editing conditions, and attaching them to campaigns is a marketing task. The REST API with an OpenAPI spec and code samples is there if you want to automate the scoring logic itself.
How do I stop old interest from skewing segments? Add a recency condition to every behavior segment — "viewed in the last 30 days" rather than "ever viewed." You can also decay scores over time, or reset a score field when a contact hasn't visited in a set period.
Is this GDPR-compliant? Behavior tracking is personal data processing, so it needs a lawful basis and a consent record where consent is the basis. Keep consent logs attached to the contact, configure retention so old events are deleted automatically, and make sure you can honor export and erasure requests. Mailerflow hosts data in Europe and provides consent logs, retention settings, and erasure tools to support this.
Ready to put this into practice? Add an embeddable signup form with double opt-in and build dynamic segments in Mailerflow — start free.


