Sub topic 7
Building a first-party data foundation
This chapter assumes you know basic digital marketing terms (campaigns, conversions, funnels), have used web analytics and a tag manager, and understand what a cookie is. It follows the chapters on consent, so every step below assumes the visitor has already made a consent choice.
What first-party data is
First-party data is information you collect directly from people through your own properties: your website, app, checkout, email list, support desk and stores. You collect it under your own privacy notice. It is different from third-party data, which another company collected and sold to you.
Its value comes from control. Browsers and platforms restrict cross-site tracking, but they do not block you from recording what a customer does on your own site, when they agree to it.
The working model
A foundation has four layers.
- Collection: consented events and form data from your own domain.
- Identity: a stable key, such as a customer ID, that links events from the same person.
- Storage: one place, usually a warehouse or customer data platform, where the data is joined.
- Activation: sending audiences and conversions back to ad platforms, email tools and analytics.
Collect on your own domain
A cookie set from your own domain is first-party, but it is not exempt from rules. Consent law still applies. Some browsers also cap the lifetime of cookies set by JavaScript. Safari, for example, limits script-set cookies to a short period, so a 90-day value may expire much sooner.
// Set a first-party cookie from your own domain, only after the visitor has consented.
function setFirstPartyId(consented) {
if (!consented) return;
const id = crypto.randomUUID();
const maxAge = 60 * 60 * 24 * 90; // 90 days
document.cookie = `visitor_id=${id}; Max-Age=${maxAge}; Path=/; Secure; SameSite=Lax`;
}Build the identity key
Anonymous visitors are hard to follow across visits. Known customers are not. Give people reasons to identify themselves: accounts, order tracking, saved lists, newsletters. When someone signs in, attach their customer ID to later events. Keep the mapping in your own system.
Campaign source is the other signal you can always record. UTM parameters on your links tell you where a visit came from.
https://example.com/spring-sale?utm_source=newsletter&utm_medium=email&utm_campaign=spring_saleUTMs describe one visit. They cannot connect separate visits to one person without other data, such as a login.
Keep the data useful
Collecting more is not the goal. Collect what you will use and can justify.
| Data type | Example | Typical use |
|---|---|---|
| Behavioral | Product views, cart adds | Onboarding, on-site personalization |
| Transactional | Orders, returns | Lifetime value, repeat-purchase audiences |
| Declared | Preferences from a form | Segmentation, content choice |
| Campaign | UTM source, medium | Channel reporting |
Practical habits that keep a foundation healthy:
- Record the consent state and timestamp with every profile.
- Use a clear event naming scheme and document it.
- Deduplicate customers by a verified email or ID.
- Set retention periods and delete data you no longer need.
- Honor opt-outs in every connected tool, not only the one where the person clicked.
Common errors
- Treating a first-party cookie as consent-free.
- Joining data from sources whose consent purposes differ, such as using support data for ad audiences.
- Building audiences too small to use, then concluding the approach fails. Plan for smaller, higher-quality lists.
- Collecting identifiers with no activation plan.
Exercise
A visitor browses on Monday and returns on Friday in Safari, with no login. Your script-set cookie may have expired. Name two ways to link both visits to the same person reliably.
Show answer
Ask them to identify themselves, for example by signing in or following a link in an email, then attach their customer ID to the events. You can also set the cookie from your server in a first-party response, which browsers usually treat more generously than script-set cookies. Either way, only do it for visitors who consented.