Sub topic 13
Naming conventions and documentation
Custom dimensions and metrics are easy to create and hard to remove. A bad name in a property stays there, and everyone who builds a report has to read it. This chapter covers how to name parameters and definitions, how to write them down, and how to keep the two in sync.
This chapter assumes you can register a custom dimension in Admin and know the three scopes (event, user, item). It also assumes you can send parameters with gtag.js or Google Tag Manager (GTM).
Why naming matters more in GA4
Three properties of GA4 make naming choices costly.
- The parameter name is permanent. When you register a custom dimension, you pick a display name and bind it to a parameter name. You can edit the display name and description later. You cannot change the parameter name. To fix a bad one, you have to register a new dimension and send both names for a while.
- Quotas are small. A standard property allows 50 event-scoped dimensions, 25 user-scoped dimensions, 10 item-scoped dimensions and 50 custom metrics. Confirm the current figures in Google's documentation. Duplicates such as
planTierandplan_tieruse up quota. - Names are case-sensitive.
plan_tierandPlan_Tierare two different parameters. Only one of them will ever match the dimension you registered.
Rules GA4 enforces
Some rules are not optional. Data that breaks them is dropped or never reaches reports.
| Item | Rule |
|---|---|
| Event parameter name | Up to 40 characters |
| User property name | Up to 24 characters |
| Characters | Letters, digits and underscores, starting with a letter |
| Reserved prefixes | `google_`, `ga_` and `firebase_` |
| Custom dimension display name | Up to 82 characters |
| Custom dimension description | Up to 150 characters |
The user property limit of 24 characters is the one people hit most often. A name like customer_lifetime_value_band is 27 characters and will not work as a user property. Check the current limits page before you finalize a plan, because Google can change them.
Rules your team should add
GA4 accepts many names that are still bad ideas. A team convention should settle these points.
- Use
snake_casein lowercase. GA4's own recommended events and parameters (add_to_cart,item_id,search_term) use it. Following the same style keeps your parameters visually consistent with the built-in ones. - Never reuse a built-in parameter name for a different meaning. If
valuealways means monetary value, do not use it for a video length. - Name the thing, not the report. Use
plan_tier, notpricing_page_dim_1. Names likedim_1force readers to look up what they mean. - Put the unit in the name of a metric parameter when it is not obvious.
video_length_secondsis clearer thanvideo_length. - Prefer a short controlled set of values.
plan_tierwith valuesfree,proandenterpriseis easy to report on. Free-text values are not. - Be consistent between sources. The same concept sent from the website, the app and Measurement Protocol must use the same parameter name.
Display names are what report builders see, so they get a separate convention. Use plain Title Case with the scope clear from context, for example Plan Tier for an event-scoped dimension and Customer Type for a user-scoped one. Some teams add a short prefix for the owner, such as Checkout - Payment Method. Pick one style and keep it.
One definition per concept
Before you register anything, search the existing definitions for the same concept under another name. Typical duplicates are plan, plan_tier and planType, or video_length and video_duration. Each duplicate costs quota, and reports built on the wrong one give different numbers.
Also check whether a built-in dimension already covers the need. Page location, item category and many other fields are collected automatically. A custom dimension that copies one of them adds quota cost and no new information.
Document in a tracking plan
A tracking plan is a shared document that lists every event, parameter, user property and custom definition. It is the source of truth for developers, analysts and anyone who reviews changes. Without it, the property's Admin screen becomes the only record, and that screen does not say why a definition exists.
For each entry, record at least these fields:
- the event name and when it fires
- the parameter name and its data type (text or number)
- the allowed values or the range
- the scope (event, user or item) and, if registered, the display name
- the metric unit, for custom metrics
- an owner, and the date it was added
- whether the data might contain personal information (it must not)
You can use a spreadsheet, a wiki table or a file in the same repository as your site code. A file in the repository has an advantage. Changes go through review, and the history shows who added a parameter and when.
Here is a small tracking plan expressed as JavaScript data, with a check that enforces the rules from this chapter. It runs in Node.js with no dependencies.
const MAX_LENGTH = { event: 40, item: 40, user: 24 };
const NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
const RESERVED_PREFIXES = ['google_', 'ga_', 'firebase_'];
const plan = [
{ name: 'plan_tier', scope: 'event', owner: 'growth', description: 'Plan chosen on the pricing page' },
{ name: 'billing_cycle', scope: 'event', owner: 'growth', description: 'Monthly or annual billing' },
{ name: 'customer_type', scope: 'user', owner: 'crm', description: 'Subscriber or visitor' },
{ name: 'item_color', scope: 'item', owner: 'shop', description: 'Color of the product variant' },
{ name: 'customer_lifetime_value_band', scope: 'user', owner: 'crm', description: '' }
];
function lint(entries) {
const problems = [];
const seen = new Set();
for (const entry of entries) {
const label = `${entry.scope}:${entry.name}`;
if (!NAME_PATTERN.test(entry.name)) {
problems.push(`${label} must be lowercase snake_case starting with a letter`);
}
if (entry.name.length > MAX_LENGTH[entry.scope]) {
problems.push(`${label} is ${entry.name.length} characters; the ${entry.scope} limit is ${MAX_LENGTH[entry.scope]}`);
}
if (RESERVED_PREFIXES.some((prefix) => entry.name.startsWith(prefix))) {
problems.push(`${label} uses a reserved prefix`);
}
if (!entry.description) {
problems.push(`${label} has no description`);
}
if (seen.has(label)) {
problems.push(`${label} is defined twice`);
}
seen.add(label);
}
return problems;
}
const problems = lint(plan);
console.log(problems.length ? problems.join('\n') : 'Tracking plan is valid');Running it prints two problems for customer_lifetime_value_band: it is 28 characters against a limit of 24, and it has no description. Run a check like this in your continuous integration (CI) pipeline, or before each GTM publish, so that violations are caught before data is collected.
A change process
A short process prevents most naming mistakes. The diagram shows the order of steps.
Two points about this order matter. First, name review comes before implementation. Once real data is flowing under a bad parameter name, you can only add a new one. Second, you register after DebugView confirms the parameter arrives with the exact spelling. A typo in registration binds the dimension to a parameter that nothing sends.
Keeping Admin and the plan in sync
Over time the tracking plan and the property drift apart. Run a periodic audit, for example every quarter.
- Export or list the custom definitions in Admin.
- Compare each one with the tracking plan.
- For definitions in Admin but not in the plan, find the owner or archive the definition.
- For parameters in the plan that were never registered, decide whether to register them or remove them from the plan.
- Check for dimensions that have no data in recent reports. These are candidates for archiving.
Archiving removes a definition from reports. It cannot be undone for that definition's history, so confirm with the owner first. Check Google's documentation on whether archived definitions still count toward your quota.
Use the description field in Admin to store the information that reviewers need: what the parameter means, where it is sent from, and a link to the tracking plan entry. It is limited to 150 characters, so keep it short.
Common mistakes
- Inconsistent case. A developer sends
Plan_Tierfrom the app while the website sendsplan_tier. Only one is registered, so half the data is missing from reports. - Different names per platform. Web uses
video_lengthand the app usesvideo_duration. You then need two dimensions, and reports need workarounds. - Names that depend on a campaign.
summer_sale_2026_flagis meaningless next year and wastes quota. Use a general parameter such aspromotion_namewith changing values. - Overlong user property names. Names above 24 characters are not accepted.
- No owner. When nobody owns a definition, nobody dares to remove it.
Exercise
A teammate wants a user property called customer_lifetime_value_band and plans to register it as a user-scoped custom dimension. Name two problems with this plan and propose a fix.
Show answer
The name has 28 characters, which is over the 24-character limit for user property names, so GA4 will not accept it. There is also no description or owner in the tracking plan, so the definition would be undocumented. A fix is a shorter lowercase snakecase name such as `clvband` (8 characters), with a tracking plan entry that records its meaning, allowed values, owner and scope before it is implemented and registered.
Exercise
Your website sends plan_tier and your iOS app sends planTier for the same concept. The dimension Plan Tier is registered for plan_tier. What happens in reports, and how do you fix it without losing history?
Show answer
Reports for Plan Tier only include data from the website, because parameter names are case-sensitive and the app's planTier is a different, unregistered parameter. Change the app to send plan_tier. Do not rename the registered dimension's parameter, because that cannot be edited. Data the app sent under planTier before the fix is not retroactively added to the dimension. Record the change date in the tracking plan so analysts know why the numbers jump.