Home / Free tools

Free tool

GA4 Measurement Protocol validator

Paste the JSON body of a Measurement Protocol request, the URL line followed by the body, or a curl command. Each problem comes back with the rule it breaks, the Google page that sets the rule, and the code the validation server would most likely return.

Checked in your browser. Nothing is sent to Google or anywhere else, and there is no api_secret to fill in.

Examples:

Also free: Tracking request decoder · Tracking HAR analyzer

Where a request goes

Events are sent with POST https://www.google-analytics.com/mp/collect, or https://region1.google-analytics.com/mp/collect for the EU endpoint. The query string carries api_secret, which is required and belongs on your server, never in client-side code. A web stream adds measurement_id to the URL and sends client_id in the body; an app stream adds firebase_app_id and sends app_instance_id. Mixing the two pairs is an error the validator flags.

The same hosts answer on /debug/mp/collect: that is the validation server. It returns {"validationMessages": [...]}, each message with a fieldPath, a description and a validationCode, and validation requests do not appear in reports. See Google’s Sending events and Validating events.

Limits

WhatLimit
Request bodySmaller than 130 kB
Events per request25
Event name40 characters; letters, digits and underscores; starts with a letter
Parameters per event25
Parameter name40 characters, same naming rule
Parameter value100 characters (500 on GA4 360)
User properties25 per request
User property name24 characters
User property value36 characters
timestamp_microsMicroseconds, backdated up to 72 hours
items per event200 (ecommerce guide)

From the Measurement Protocol reference and the GA4 ecommerce guide. Google’s pages disagree on how many custom parameters an item takes through the Measurement Protocol, so the validator does not count them.

Reserved names

Event names that cannot be sent: ad_activeview, ad_click, ad_exposure, ad_query, ad_reward, adunit_exposure, app_clear_data, app_exception, app_install, app_remove, app_store_refund, app_update, app_upgrade, dynamic_link_app_open, dynamic_link_app_update, dynamic_link_first_open, error, firebase_campaign, firebase_in_app_message_action, firebase_in_app_message_dismiss, firebase_in_app_message_impression, first_open, first_visit, notification_dismiss, notification_foreground, notification_open, notification_receive, notification_send, os_update, session_start, user_engagement. ad_impression, in_app_purchase, screen_view are for app streams only; a web stream uses page_view and purchase.

Parameters: firebase_conversion is reserved, and names cannot begin with _, firebase_, ga_, google_, gtag.

User properties: first_open_time, first_visit_time, last_deep_link_referrer, user_id, first_open_after_install are reserved, and names cannot begin with _, firebase_, ga_, google_. Each one is sent as {"name": {"value": ...}}.

session_id and engagement_time_msec

Google asks you to include both for sessions and engagement to count correctly: Realtime, Engaged sessions and Average engagement time read them. session_id is a number matching ^\d+$; engagement_time_msec is a number. The validator warns on each event that lacks either, and on values sent as strings.

Consent

consent takes ad_user_data and ad_personalization, each "GRANTED" or "DENIED". non_personalized_ads is deprecated.

Ecommerce events

purchase needs transaction_id and items, and refund needs transaction_id. Every item needs item_id or item_name. When value is set, currency is required. Google defines value as the sum of price times quantity over the items and says not to include shipping or tax; a different total is shown as a note, not an error.

Validation codes

The validation server answers with one of VALUE_INVALID, VALUE_REQUIRED, NAME_INVALID, NAME_RESERVED, VALUE_OUT_OF_BOUNDS, EXCEEDED_MAX_ENTITIES, NAME_DUPLICATED. The validator shows the one it expects as “likely server code” where the match is plain: a reserved name is NAME_RESERVED, a 26th event EXCEEDED_MAX_ENTITIES, a parameter key written twice NAME_DUPLICATED. Repeating an event in the events array is allowed and not flagged. validation_behavior is "RELAXED" by default; "ENFORCE_RECOMMENDATIONS" is for validating, not production.

This page does not replace /debug/mp/collect. The validation server checks things a page cannot, and it does not check api_secret or firebase_app_id either. A 2xx from /mp/collect only means the request was received: malformed data gets no error there.

Questions

Does /debug/mp/collect check my api_secret?

No. Google’s validation server does not check api_secret or firebase_app_id, so a request with a wrong secret can come back with no validation messages.

Why does /mp/collect answer 2xx when my events never show up?

A 2xx from /mp/collect only means the request was received. Malformed data gets no error there. Send the same request to /debug/mp/collect, which answers with validationMessages; an empty list means it found no issues. Validation requests do not appear in reports.

Do I have to send session_id and engagement_time_msec?

Google says to include both for sessions and engagement to count correctly: Realtime, Engaged sessions and Average engagement time depend on them. session_id is a number matching ^\d+$; engagement_time_msec is a number of milliseconds.

How far back can timestamp_micros go?

Up to 72 hours. The value is a Unix time in microseconds, which today is a 16-digit number. A 13-digit value is milliseconds and a 10-digit one is seconds.

Is what I paste sent anywhere?

No. The request is read and checked in your browser and never sent to Google or anywhere else. If it contains an api_secret, the page hides most of it in what it shows; keep the secret out of client-side code and out of shared screenshots.

Try it on your own site

Tag Master is free, needs no account, and collects no data.

Add to Chrome, it’s free