Sub topic 11
Linking events and records into one customer profile
Identity resolution is the process of deciding that several events and records belong to the same person, then merging them into one customer profile. This chapter assumes you know what a CRM, a CDP and a warehouse are, and that you have seen how first-party and zero-party data are collected. Here you will see how the pieces get joined, where joins go wrong, and how consent travels with the profile.
Why one customer looks like many
A single shopper leaves traces in many systems:
- An anonymous web visit with a cookie ID.
- A mobile app session with a device ID.
- A newsletter signup with an email address.
- A store purchase tied to a loyalty number.
- A support ticket tied to a phone number.
- A preference center answer tied to a login.
Each system gives that person a different key. Without linking, you count one person five times, send duplicate emails, and personalize a website visit without knowing the visitor already bought last week.
Identifiers: the keys you link on
An identifier is a value that points to a person or a device. They differ in how stable they are and how much they reveal.
| Identifier | Type | Stability | Notes |
|---|---|---|---|
| Customer ID | Known, internal | High | Assigned by you at account creation |
| Email address | Known | High | Strong match key, but people have several |
| Phone number | Known | High | Needs consistent formatting |
| Loyalty number | Known | High | Only covers members |
| First-party cookie ID | Anonymous | Low to medium | Browser-specific, can expire or be cleared |
| Device ID or app instance ID | Anonymous | Medium | One per app install |
Anonymous identifiers become useful once the person identifies themselves, for example by logging in or clicking an email link.
Two ways to match: deterministic and probabilistic
Deterministic matching links records that share an exact identifier, such as the same email or the same customer ID. It is precise and easy to explain. Its limit is coverage: it only links what the person has identified.
Probabilistic matching estimates the chance that two records belong to the same person from signals like device type, IP address, location and behavior. It reaches further but makes mistakes, and it is harder to justify to a customer or a regulator.
For a first-party and zero-party program, start with deterministic matching. The person gave you the identifier, so the link rests on something they did. Treat probabilistic matching as an opt-in extension that needs a clear legal basis and review.
| Aspect | Deterministic | Probabilistic |
|---|---|---|
| Basis | Exact shared identifier | Statistical similarity |
| Accuracy | High | Varies, produces false matches |
| Coverage | Limited to identified people | Wider |
| Explainability | Easy | Difficult |
| Privacy risk | Lower | Higher |
How an identity graph is built
An identity graph is a data structure that stores identifiers as nodes and the observed links between them as edges. A profile is a connected group of nodes. The usual flow is:
- Collect events with whatever identifier is available.
- Normalize identifiers (trim spaces, lowercase emails, standardize phone formats).
- Look for an identifying event, such as login, signup or checkout, that ties an anonymous ID to a known ID.
- Add an edge between the two identifiers.
- Assign every connected identifier the same profile ID.
- Merge the attributes and event history under that profile ID.
A worked example
Suppose three records exist:
- Event 1: cookie
ck_77views trail running shoes. - Event 2: cookie
ck_77signs up for the newsletter with[email protected]. - Record 3: the CRM holds customer
c_123with email[email protected].
Event 2 links ck_77 to the email. After normalization, the email matches the CRM record. The result is one profile containing the earlier browsing, the signup and the CRM history.
The following Python sketch shows the core logic with a union-find structure. It runs as written.
def normalize_email(email: str) -> str:
return email.strip().lower()
class IdentityGraph:
def __init__(self):
self.parent = {}
def find(self, x):
self.parent.setdefault(x, x)
while self.parent[x] != x:
self.parent[x] = self.parent[self.parent[x]]
x = self.parent[x]
return x
def link(self, a, b):
root_a, root_b = self.find(a), self.find(b)
if root_a != root_b:
self.parent[root_b] = root_a
graph = IdentityGraph()
# Event 2: login or signup ties a cookie to an email
graph.link("cookie:ck_77", "email:" + normalize_email("[email protected]"))
# CRM record ties a customer ID to the same email
graph.link("customer:c_123", "email:" + normalize_email("[email protected]"))
same_person = graph.find("cookie:ck_77") == graph.find("customer:c_123")
print(same_person) # TrueProduction systems add timestamps, source names and the ability to undo a link, but the principle is the same.
Merge rules: which value wins
When two records are merged, they may disagree. One says the city is Leeds, the other says Bristol. You need a survivorship rule that decides which value to keep. Common rules:
- Most recent wins, good for addresses and phone numbers.
- Most trusted source wins, for example CRM over a web form.
- Customer-stated wins, which applies to zero-party data. If a customer told you in the preference center that they prefer trail running, an inferred value from browsing should not overwrite it.
Keep the losing value and its source in a history table instead of deleting it. That makes merges auditable and reversible.
Consent travels with the profile
Merging profiles also merges consent, and this is where errors do real harm. Consent was granted to a purpose, on a channel, at a time, by a particular person. Suppose an anonymous browser session had declined analytics cookies, and the same person later signed up for email. You must not use the earlier browsing events for personalization if the person declined that purpose when those events were collected.
Rules to apply:
- Store consent per purpose, with status and timestamp, as in the consent records shown earlier in this tutorial.
- Tag each event with the consent state at collection time.
- When profiles merge, keep each event's original consent tag. Do not upgrade it to the newest consent.
- When two profiles have conflicting consent for the same purpose, apply the most restrictive status until you can confirm.
- Honor withdrawals across every linked identifier, not just the one used when the person opted out.
Checking the link in SQL
A consent-aware profile query keeps linking and permission in the same place. This example assumes a table that maps identifiers to profile IDs.
SELECT p.profile_id, p.email
FROM profiles AS p
JOIN identity_links AS l
ON l.profile_id = p.profile_id
JOIN consents AS k
ON k.profile_id = p.profile_id
WHERE k.purpose = 'personalization'
AND k.status = 'granted'
GROUP BY p.profile_id, p.email;The GROUP BY collapses multiple linked identifiers into one row per profile, so a person with three cookies is not counted three times.
Common errors
- False merges. Two people share a family email or a shared device and get collapsed into one profile. Symptoms: a customer sees a partner's recommendations. Guard against it by excluding shared identifiers such as
info@addresses and by capping how many cookies may link to one profile. - Missed merges. Typos,
+aliases and inconsistent phone formats keep records apart. Normalize before matching and review near-duplicates. - Overwriting stated data with inferred data. Protect zero-party fields with the survivorship rule above.
- Merging without a record. If you cannot say which event caused a link, you cannot unwind it. Log the source, time and rule for every edge.
- Ignoring deletion requests. A deletion request must reach every linked identifier and every downstream copy.
- Treating cookie IDs as permanent. Browsers limit the lifetime of some cookies, so anonymous history may detach from a person. Re-link at the next login instead of assuming continuity.
How to evaluate the result
Track a few measures to know whether resolution is working:
- Match rate: the share of events that attach to a known profile.
- Duplicate rate: the share of profiles that a review shows to be the same person.
- False merge rate: the share of sampled profiles that contain more than one person. Check a small sample by hand each quarter.
- Profiles per identifier type, to spot a cookie that links to hundreds of people.
A higher match rate is not automatically better. A rise that comes with more false merges means your rules loosened too far.
Exercise
A visitor browses on a laptop where they declined personalization cookies. A week later they log in on the app with the same email as an existing CRM record, and the CDP merges both into one profile. They granted personalization consent in the app. Can the earlier laptop browsing events be used for personalization? Name the rule that applies and one way to prevent a mistake.
Show answer
No. Each event keeps the consent state from when it was collected, and the laptop events were collected after the person declined personalization. The newer consent covers events collected from then on, not the earlier ones. To prevent a mistake, tag every event with its consent state at collection and filter on that tag in segment queries, so a merge cannot widen how the data is used.
Exercise
Two customers share the email address [email protected], and the identity graph merges them into one profile. Give two controls that reduce this false merge risk.
Show answer
Exclude known shared or role-based addresses from deterministic matching, and cap the number of cookies or devices that can link to one profile so unusual clusters are flagged for review. Preferring a customer ID or login over email as the main key also helps.