Sub topic 12
Avoiding high cardinality and personal data
This chapter assumes you can already send event parameters and user properties, and that you have registered at least one custom dimension in Admin. It covers two ways a well-intended custom dimension goes wrong. The first is high cardinality, which makes the dimension unusable in reports. The second is personal data, which breaks Google's terms and creates a legal problem.
What cardinality means in GA4
Cardinality is the number of distinct values a dimension takes. plan_tier with values free, pro and enterprise has a cardinality of 3. A dimension holding a session timestamp, a search query, or a user's email address can have millions.
Low cardinality is useful for reporting. A report table with three rows can be read at a glance, charted and compared. A table with 400,000 rows cannot.
GA4 enforces this at the system level. When a report needs more unique dimension combinations than GA4 will store for a single day, the extra rows are rolled into a single row labelled (other). In standard properties the threshold for a daily table is about 500 unique rows. GA4 360 properties have a much higher limit. The exact figures can change, so check the current Analytics Help page on cardinality before you rely on them.
The (other) row has three effects:
- The totals in the report stay correct, but you lose the detail behind the largest part of them.
- Which values land in (other) is not under your control, so the report can change from one day to the next.
- A report with an (other) row can look fine at first. The problem shows up only once traffic grows.
Cardinality is counted per day and per table. Combining a moderately high-cardinality dimension with other dimensions, such as page path plus your custom dimension, multiplies the number of unique rows. A dimension that behaves in one report can overflow in another.
Typical sources of high cardinality
| Source | Example value | Why it is a problem |
|---|---|---|
| Timestamps | `2026-11-28T15:24:19Z` | Nearly every event has a unique value. |
| Identifiers | `order_id`, `session_token` | One value per order or session. |
| Free text | Search terms, form input | Users can type anything, including typos and personal data. |
| Full URLs with query strings | `/search?q=...&sid=...` | Tracking parameters make each visit unique. |
| Unbounded numbers | `price: 29.9937` | Every decimal variation is a new value. |
Ask whether anyone will ever filter or group by an individual value. If not, you probably don't need a dimension. Order IDs, for example, belong in the standard transaction_id parameter. They can be exported to BigQuery for joins, but they don't need to appear in a report.
Fixing high cardinality
You have four main options, in rough order of preference.
- Do not register it. An unregistered parameter still reaches the raw data and the BigQuery export. It just doesn't show in reports. This is the right choice for IDs and timestamps.
- Bucket the values. Replace a continuous or open-ended value with a small set of labelled ranges.
- Normalize the values. Lowercase, trim, and strip query strings so
Pro,proandPRObecome one value. - Use a metric instead. If the value is a number you want to sum or average, such as video length, register it as a custom metric rather than a dimension.
The following function does the bucketing and normalizing before an event is sent:
function bucketCartValue(value) {
if (typeof value !== 'number' || isNaN(value) || value < 0) {
return 'unknown';
}
if (value < 25) return '0-24';
if (value < 100) return '25-99';
if (value < 500) return '100-499';
return '500+';
}
function normalizeLabel(text) {
return String(text).trim().toLowerCase().slice(0, 100);
}
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('event', 'begin_checkout', {
cart_value_bucket: bucketCartValue(137.5),
referrer_type: normalizeLabel(' Newsletter ')
});This sends cart_value_bucket: '100-499' and referrer_type: 'newsletter'. Each dimension now has at most five values. The slice(0, 100) also respects the 100-character limit on event parameter values. Check the current limit in the GA4 collection limits documentation.
The raw number still has a place. Send it separately as the standard value parameter, or as a custom metric, and keep the bucket for grouping.
Personal data (PII)
PII is personally identifiable information: data that identifies a specific person on its own or when combined with other data. Google Analytics' terms of service prohibit sending PII to Analytics. Examples include:
- Email addresses, phone numbers, full names and postal addresses.
- Government IDs, payment card numbers and similar account numbers.
- Precise location, such as exact GPS coordinates.
- Free-text fields, because users can type anything into them.
The rule applies to every route into GA4. Custom dimensions are one risk. Event parameters you never registered, user properties, user_id, page URLs, page titles and event names are others. A registered dimension does not make PII worse. An unregistered one is still a violation, because the data is stored.
Where PII leaks in
- URLs. Password-reset links, newsletter confirmation pages and form submissions that put
[email protected]into the address. GA4 recordspage_locationautomatically, so this needs no custom code. Fix it at the source or exclude the query parameters in your data stream settings. - Form values. A GTM variable that reads a form field and passes it into an event parameter.
- Search boxes. Users type names, emails and order numbers into site search, and
search_termcollects all of it. - User IDs. Sending an email address as
user_idis a common mistake. Use an internal opaque identifier that only your own systems can map back to a person.
Hashing an email address does not make it safe. A hash is still a stable identifier tied to a person. Google's own guidance treats it as personal data in the context of standard collection.
Preventing it
Treat this as a pipeline with gates, not a single review.
Practical controls:
- Allow-list the parameters. In GTM, send only named parameters. Do not forward everything in the data layer.
- Never read raw form input. Send a category such as
form_type: 'newsletter', not what the user typed. - Audit URLs. Search your page paths report for
@,email=,token=andphone=. - Review before registration. Check DebugView (covered earlier in this tutorial) for the value you are about to register. If you see an email address, stop and fix the source.
A search like the one below, run against the Data API, can help you find suspicious page locations:
{
"dateRanges": [{ "startDate": "28daysAgo", "endDate": "today" }],
"dimensions": [{ "name": "pageLocation" }],
"metrics": [{ "name": "eventCount" }],
"dimensionFilter": {
"filter": {
"fieldName": "pageLocation",
"stringFilter": { "matchType": "CONTAINS", "value": "@" }
}
}
}If PII has already been collected
Archiving the custom dimension does not remove the stored data. Deleting the dimension from the report does not either. You have to act on the data itself.
- Fix the source so no more PII is sent.
- Open a data deletion request in the property's Data Settings in Admin. It covers data for the parameters or user properties you specify, within the limits the tool offers.
- If you export to BigQuery, delete or rewrite the affected rows in your own dataset. A GA4 deletion request does not reach your exported copy.
- Tell your privacy or legal contact. Depending on where your users live, you may have notification duties.
Cardinality and PII together
The two problems often appear together. Free-text fields are the clearest example: they have high cardinality because every entry differs, and they carry PII risk because users type personal details. If a dimension fails the cardinality check, it deserves the PII check too. The reverse is less true. An email-domain dimension, such as gmail.com, has modest cardinality and no direct identifier, though you should still confirm it is allowed under your privacy policy.
Exercise
A teammate wants to register an event-scoped custom dimension called search_query from the site search box, and a second dimension called session_start_time containing a full timestamp. Name the problem with each and propose a replacement for each.
Show answer
search_query has high cardinality, because every typed query can differ, and it carries PII risk, because users may type names or emails. Replace it with a bounded value such as search_result_count_bucket (0, 1-10, 11+), or a normalized category taken from a fixed list of search filters. If the raw queries are needed for analysis, scrub them and leave them unregistered, or review them only in a protected BigQuery export. session_start_time has near-unique values per session, so it would overflow into the (other) row. Replace it with a coarse bucket such as hour_of_day (0-23) or day_part (morning, afternoon, evening, night). Standard GA4 dimensions such as date and hour already cover most needs, so check whether any custom dimension is needed at all.
Exercise
A report using your custom dimension article_id shows an (other) row that accounts for 60% of events. List two ways to fix it that do not involve deleting data from the property.
Show answer
First, replace article_id with a lower-cardinality dimension such as article_category or content_type, and keep the ID unregistered but available in BigQuery. Second, narrow the report by filtering to a smaller set of pages or a shorter date range so that fewer unique rows are needed per day. Both work because the (other) row appears only when the number of unique values in the report table exceeds the daily limit.