Sub topic 8
Collecting first-party data across web, app, email and stores
This chapter assumes you know the four data types from earlier chapters, understand what consent and purpose mean, and have a basic idea of what a cookie is. Here you will look at how first-party data is actually gathered in each channel, and which mistakes cause bad or unusable data.
The working model
First-party data is what you observe about customers through your own properties. Every collection point does the same three jobs: it captures an event or attribute, ties it to an identifier, and records the consent state that applies. If any of the three is missing, the record is hard to use later.
The common identifiers are a first-party cookie or device ID (anonymous), and an email address, phone number or customer ID (known). Anonymous activity becomes useful when it can later be linked to a known identifier, a topic covered in the identity chapter.
Channel by channel
| Channel | What you collect | Typical identifier | Common error |
|---|---|---|---|
| Web | Page views, product views, searches, cart events, form fills | First-party cookie, then email after login or signup | Firing tags before consent is recorded |
| App | Screens, taps, purchases, push opt-in | Device ID, then user ID after login | Never sending the user ID, so app and web stay separate |
| Sends, opens, clicks, unsubscribes | Email address | Treating opens as reliable, because mail apps can preload images | |
| Stores | Purchases, returns, loyalty activity | Loyalty ID, email at checkout, phone number | Collecting an email at the till without telling the customer how it will be used |
Following one customer
The consent check sits before storage. Data you were not allowed to collect should never enter the store, because removing it later is much harder.
A consistent event format
Use one event shape across channels so records can be combined. The example below is a runnable Python function that builds an event and refuses to create one when consent is missing.
from datetime import datetime, timezone
def build_event(customer_id, channel, name, consents, purpose="analytics"):
if consents.get(purpose) != "granted":
return None # do not collect without consent for this purpose
return {
"customer_id": customer_id,
"channel": channel,
"event": name,
"purpose": purpose,
"collected_at": datetime.now(timezone.utc).isoformat(),
}
consents = {"analytics": "granted", "email_marketing": "denied"}
print(build_event("c_123", "web", "product_viewed", consents))
print(build_event("c_123", "email", "campaign_sent", consents, "email_marketing"))The first call returns an event. The second returns None, because email marketing consent is denied.
Common errors
- Collecting everything "just in case." Each field needs a stated purpose. Unused data adds risk and cost without value.
- Inconsistent names.
product_viewed,ProductViewandview_productsplit one behavior into three. Agree on a naming standard and a tracking plan. - Client-side only tracking. Ad blockers and browser limits drop some browser events. Sending key events from your server, such as purchases, improves accuracy.
- No identifier link. Without a shared customer ID, web, app and store records stay as separate profiles.
- Short cookie life. Some browsers limit the lifetime of cookies set by scripts, so returning visitors may look new. Login prompts that earn a durable ID address this.
Check your understanding
Exercise
A retailer's app and website both track purchases, but analysts find the same shoppers counted twice. Name the most likely cause and one fix.
Show answer
The app and web events use different identifiers and the app never sends a shared customer ID. Fix it by passing the logged-in customer ID with every app and web event, so records can be linked to one profile.
Exercise
Why should the consent check happen before data is stored instead of during later cleanup?
Show answer
Data collected without a valid purpose or consent may already be unlawful, and it can spread to other systems. Blocking it at collection avoids that and is simpler than deleting it afterward.