Sub topic 14
Common pitfalls and how to avoid them
This chapter assumes you have read the earlier chapters on events, parameters, identity, sessions, and the BigQuery export. You should be able to read gtag JavaScript and write basic SQL. Most GA4 surprises come from carrying habits over from older, session-based tools. They also come from forgetting that every number in GA4 is derived from events. Each section below names a pitfall, explains the mechanism behind it, and shows how to avoid it.
Where pitfalls come from
GA4 stores events. Users, sessions, and engagement are calculated from those events, and reports show the results. When a number looks wrong, the cause usually sits in one of three places: what you sent, how GA4 configured it, or how a report counts it.
The diagram traces that path and marks where the pitfalls in this chapter occur.
Event design pitfalls
Sending parameters but not registering them
A custom parameter such as step_number is collected as soon as you send it. It still does not appear in standard reports or Explorations until you register it as a custom dimension or custom metric. The data is not lost, because it stays in the BigQuery export. But GA4 only applies a registration going forward. Data collected before registration does not appear in the new dimension.
To avoid this, register parameters at the same time you ship the tracking code. Choose the scope that matches the data:
- Use event scope for a value that describes one event, such as
step_number. - Use user scope for a value that describes the person, such as
plan_type. - Use a custom metric when you want to sum or average a number, such as
value-like amounts.
Hitting limits on custom definitions
Each property has a fixed number of custom dimensions and metrics. Standard properties have lower limits than GA4 360 properties. Limits also apply to event names, parameters per event, and user properties. Check the current figures in the Google documentation, because they change.
Avoid spending those slots on values with many unique entries, such as a timestamp or a full URL with query strings. High-cardinality values can also be grouped into an "(other)" row in reports. A good practice is to keep a tracking plan, which is a table of event names, parameters, and their registered definitions.
Inconsistent event and parameter names
Event names and parameter names are case-sensitive. Add_To_Cart, add_to_cart, and addToCart are three different events. If a developer on one platform uses a different spelling, your data splits across rows and funnels break silently.
- Pick one convention, such as
snake_case, and write it down. - Use the recommended event names when one fits, for example
add_to_cartandpurchase. Recommended events unlock built-in reports and features. - Do not reuse a reserved name or prefix. Names beginning with
google_,ga_, orfirebase_are reserved.
Sending personally identifiable information
Google's terms forbid sending personally identifiable information (PII) to GA4. This includes email addresses, phone numbers, and full names. This applies to event parameters, user properties, page URLs, and the user_id value. A common accident is a URL like /[email protected], which GA4 stores in page_location.
To avoid this, use an internal opaque ID for user_id, not an email address. Audit your URLs for query strings that contain personal data. Redact or strip those parts before the page view fires.
Putting the wrong thing in the items array
The items array describes products, so it belongs on ecommerce events. Two mistakes are common. First, sending value that does not match the sum of price × quantity, which makes revenue reports disagree with item reports. Second, omitting item_id or item_name, because item-level reports need at least one of them. Keep currency consistent as well. A missing currency on a purchase can leave revenue unrecorded.
Identity and counting pitfalls
Expecting one person to equal one user
Without User-ID, GA4 recognizes a user by a client ID stored in a browser cookie or app instance. One person with a laptop, a phone, and a private window appears as three users. Clearing cookies creates a new one. Setting user_id helps, but only for activity sent while the visitor is signed in. Events before sign-in carry no user_id, though GA4 can sometimes link them to the signed-in user.
// Send user_id only after sign-in, and never an email address
gtag('config', 'G-XXXXXXXXXX', {
user_id: 'u_12345'
});You should also remember that reporting identity settings affect which identifiers GA4 uses. In a report, user counts may differ depending on whether the property uses the blended, observed, or device-based identity.
Confusing total users and active users
Total users counts everyone who triggered any event. Active users counts users who had an engaged session or triggered first_visit or engagement_time-based activity. In many standard reports, "Users" now means active users. If you compare a custom report using total users with a standard report using active users, the two will not match, and neither is wrong.
| Metric | What it counts | Typical cause of mismatch |
|---|---|---|
| Total users | Distinct users with any event | Includes users with no engagement |
| Active users | Distinct users with an engaged session, or who triggered `first_visit` or `first_open` | Excludes brief, unengaged visits |
| New users | Users whose first-ever interaction occurred in the period | Cookie loss re-counts returning visitors as new |
When you share a number, say which of these you mean.
Assuming sessions behave like the old model
A session is derived from events. GA4 starts one when it sees a session_start event, and it assigns a ga_session_id. Three behaviors surprise people:
- A session ends after 30 minutes of inactivity by default. You can change this timeout in the web data stream settings.
- Sessions do not restart at midnight or when the campaign source changes. Older tools did both.
- Events sent with no session context, such as some Measurement Protocol hits, can create sessions you did not expect, or none at all.
Also check whether your own tooling interferes. Cross-domain navigation without proper linking can split one visit into two sessions. A payment provider can then show up as a referral source, and traffic that should be credited to a campaign is credited to the payment domain. List the payment provider and any other third-party domains you send visitors to in the unwanted referrals setting.
Misreading engagement rate and bounce rate
An engaged session lasts longer than 10 seconds, or has a key event, or has at least two page or screen views. Engagement rate is engaged sessions divided by sessions. Bounce rate is the opposite: unengaged sessions divided by sessions. A single-page blog post can have a high bounce rate and still have readers who spent four minutes on it, if the page did not meet the engagement threshold. The 10-second default is configurable. Judge whether the metric fits your content before you act on it.
Configuration pitfalls
Marking too many events as key events
A key event is an event you flag as important to your business. Key events are counted in reports, can be imported into Google Ads, and feed the engaged-session rule. If you mark every event as a key event, the signal disappears, and engagement figures inflate. Mark only the few events that map to a business outcome, such as purchase or generate_lead.
Key events are also not retroactive. Marking an event as a key event affects data from that moment, not earlier data. Decide on key events early, and note the change date in your documentation.
Forgetting that data takes time
Standard reports can lag by 24 to 48 hours. Some dimensions and metrics are populated late, and attribution may be reprocessed. The Realtime report is the right place to test that an event arrives, but it is not a place to check final numbers. For testing tracking code, use DebugView, which shows events from a device in debug mode with their parameters.
Not looking at data thresholds and sampling
When reports contain demographic or other Google-signals data, GA4 can apply data thresholds. This hides rows with small counts to protect privacy. Explorations can also be sampled when a query covers a very large number of events. Look for the indicator at the top of a report. If a report is sampled or thresholded, compare it with a smaller date range, or use the BigQuery export for exact event-level counts.
Analysis pitfalls in BigQuery
Treating nested fields as flat columns
In the export, each row is one event. Parameters sit in the repeated event_params field. You cannot write event_params.ga_session_id. You have to unnest it or use a subquery that selects the right key. Each parameter also stores its value in a typed field, such as int_value, string_value, or double_value. Reading the wrong field returns NULL.
-- Read a string parameter and an integer parameter from event_params
SELECT
event_date,
event_name,
(SELECT ep.value.string_value
FROM UNNEST(event_params) AS ep
WHERE ep.key = 'page_location') AS page_location,
(SELECT ep.value.int_value
FROM UNNEST(event_params) AS ep
WHERE ep.key = 'ga_session_id') AS ga_session_id
FROM `my-project.analytics_123456789.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20240101' AND '20240131'
AND event_name = 'page_view'
LIMIT 100;Counting sessions by `ga_session_id` alone
The value of ga_session_id is the session's start time, as a Unix timestamp. Two different users can share the same value. A session needs the combination of user_pseudo_id and ga_session_id, as in the earlier session-counting query. Counting distinct ga_session_id values on their own will undercount.
Joining on `UNNEST` and multiplying rows
If you use CROSS JOIN UNNEST(event_params) and then count rows, you multiply each event by its number of parameters. Counts then grow far above the true number of events. Use a scalar subquery for a single key, as shown above. Alternatively, filter the unnested rows to one key before you aggregate.
Expecting BigQuery to match the interface exactly
The two will often differ a little. The interface uses modeled data, thresholds, and, for some metrics, approximate counts (HyperLogLog++). The export holds raw events. The export also has no data from consent-declined users, and the streaming and daily tables differ in completeness. Table events_intraday_* holds today's partial data. Do not mix it with finished daily tables when you compare days. Expect differences of a few percent, and investigate only when they are larger.
Ignoring the time zone
The event_date column uses the property's reporting time zone, while event_timestamp is in UTC microseconds. If you filter by timestamp and compare with the interface, your day boundaries will not agree.
A short checklist
- Write a tracking plan with event names, parameters, and scopes.
- Register each parameter you intend to report on, at launch.
- Use opaque IDs, never PII.
- Choose and document your user metric: total, active, or new.
- Use DebugView to test, and wait a day before judging reports.
- In BigQuery, use
user_pseudo_idplusga_session_id, and unnest with subqueries.
Exercise
A dashboard built in Looker Studio shows 12,400 "Total users" for last month, while the standard GA4 Reports show 10,900 "Users" for the same dates. A colleague says the tracking is broken. Give two likely explanations that do not involve broken tracking, and say how you would confirm each.
Show answer
First, the two numbers may measure different things. Total users counts every user with any event, while the standard "Users" metric is active users, which excludes users who never had an engaged session. Confirm by adding both the total users and active users metrics to the same report for the same date range. Second, the reports may differ in thresholds, sampling, or identity settings. Check the top of each report for a data-threshold or sampling indicator, and compare the property's reporting identity setting. If the difference remains, run a BigQuery query that counts distinct userpseudoid for the same period to get a raw baseline.
Exercise
This query is meant to count sessions per day, but it returns a number far larger than the true count. Find the problem and fix it. SELECT eventdate, COUNT(*) AS sessions FROM `my-project.analytics123456789.events*`, UNNEST(eventparams) AS ep WHERE TABLESUFFIX BETWEEN '20240101' AND '20240131' AND ep.key = 'gasessionid' GROUP BY event_date;
Show answer
The query counts rows, not sessions. Each event with a gasessionid parameter produces one row, so a session with 20 events is counted 20 times. The fix is to count distinct combinations of userpseudoid and gasessionid: COUNT(DISTINCT CONCAT(userpseudoid, '.', CAST(ep.value.intvalue AS STRING))). Using gasession_id alone is not enough, because different users can share the same value.