Sub topic 12
Avoiding High Cardinality and Personal Data
Assume you understand GA4 events, custom dimensions, and basic JavaScript or Google Tag Manager. This chapter focuses on deciding which values are safe and useful to register.
Why cardinality matters
Cardinality is the number of distinct values in a dimension. A dimension such as plan_tier might have three values: free, pro, and enterprise. A dimension such as user_id might have millions.
High-cardinality dimensions are harder to analyze. GA4 may combine less common values into an (other) row when a report exceeds its processing limits. This means the report no longer shows every value separately. The underlying event data may still be available in BigQuery, depending on your setup, but the standard report can be less useful.
| Dimension value | Cardinality | Typical decision |
|---|---|---|
| `plan_tier = pro` | Low | Good custom dimension |
| `store_region = north` | Low to medium | Usually useful |
| `article_slug = changing-page-name` | Medium to high | Review the purpose |
| `transaction_id = 8f31...` | Very high | Do not use as a reporting dimension |
Avoid values that change for every event or user. Common examples include timestamps, random UUIDs, transaction IDs, full URLs with query strings, and unrestricted search terms. These values often create many rows without supporting a meaningful comparison.
Personal data is a separate risk
Personal data, often called personally identifiable information (PII), is information that identifies or can help identify a person. Examples include email addresses, telephone numbers, names, postal addresses, and account numbers that can be connected to a person.
Do not send PII to GA4 in event parameters, user properties, item parameters, page URLs, or custom dimensions. Registering a parameter does not make unsafe data acceptable. Hashing an email address is also not a reliable solution because a stable hash can still be used as a persistent identifier.
A pseudonymous internal identifier can be appropriate only when it follows Google's current policies and your organization's privacy requirements. It must not contain an email address or another directly identifying value. Document the purpose and retention rules before using one.
Filter values before sending
Use an allowlist for values with a known, small set of choices. Bucket values when exact detail is unnecessary. For example, send 0-9, 10-49, and 50+ instead of an exact account size.
This example keeps the values useful for reporting and ignores an email address supplied by the application:
const allowedPlans = new Set(["free", "pro", "enterprise"]);
function buildAnalyticsParams(input) {
const planTier = allowedPlans.has(input.planTier)
? input.planTier
: "unknown";
const teamSize =
input.teamSize < 10 ? "0-9" :
input.teamSize < 50 ? "10-49" :
"50+";
return {
plan_tier: planTier,
team_size: teamSize,
customer_type: input.customerType === "subscriber"
? "subscriber"
: "non_subscriber"
};
}
console.log(buildAnalyticsParams({
planTier: "pro",
teamSize: 23,
customerType: "subscriber",
email: "[email protected]"
}));The returned object contains controlled values. The email field is never copied into analytics data.
Review a proposed dimension
Use this decision path before creating a custom definition:
A value should answer a known question, such as “Which plan produces the most conversions?” It should not exist merely because the application already has the value.
Apply governance consistently
Keep a short inventory for every custom definition. Record its parameter name, scope, allowed values, business purpose, owner, and privacy classification. Use stable lowercase names with underscores, such as plan_tier and store_region.
Review new parameters before deployment. Check the browser request or Google Tag Manager preview, then confirm the value in DebugView. Test unusual inputs, including missing values, unexpected text, and values containing an email address.
Exercise
You need to compare conversions by marketing campaign. The application can send a campaign name, a full landing-page URL with query parameters, or a visitor's email address. Which value should you choose, and what should you check first?
Show answer
Choose the campaign name if it comes from a controlled list or follows a bounded naming convention. Check that it contains no personal data and will not create an uncontrolled number of unique values. Do not use the email address. Use the full URL only when its query parameters are removed and the resulting values support a clear reporting question.