DebugView in GA4<\/li>\n<\/ol>\n\n\n\nUsing the debugging endpoint<\/h2>\n\n\n\n The first step to working with GA4 MP is to use the debugging endpoint when building out your API.<\/p>\n\n\n\n
A standard GA4 MP request will use this endpoint:<\/p>\n\n\n\n
https:\/\/www.google-analytics.com\/mp\/collect?api_secret=abcdefghijklmnop&measurement_id=G-123456789<\/code><\/p>\n\n\n\nThis endpoint will return only a 204 response.<\/p>\n\n\n
\n
204 response with no notes<\/figcaption><\/figure><\/div>\n\n\nIf you want your hits validated, you need to add the \/debug path to the endpoint<\/p>\n\n\n\n
https:\/\/www.google-analytics.com\/debug<\/mark><\/strong>\/mp\/collect?api_secret=abcdefghijklmnop&measurement_id=G-123456789<\/code><\/p>\n\n\n\n
200 response with validation notes<\/figcaption><\/figure><\/div>\n\n\n\nImportant note:<\/strong> Hits sent to the \/debug path are validated but will not show in reports.<\/p>\n<\/blockquote>\n\n\n\nUsing DebugView<\/h2>\n\n\n\n After validating that our hits have been ingested properly, now we can check if they are showing up in GA4 properly, and (hopefully) linked properly to the right sessions.<\/p>\n\n\n\n
For example, in order for you to debug a real time transaction, you will need to use GTM’s preview mode (or directly use Tag Assistant) on your website. Doing this, will stream all you real time events into GA4’s DebugView.<\/p>\n\n\n\n
The DebugView is accessible from GA’s Admin section under Data display<\/em>.<\/p>\n\n\n\n <\/figure>\n\n\n\nTo connect MP events to the debug view, the events simply need to carry the debug_mode: 1<\/code> parameter.<\/p>\n\n\n\nThis parameter is to be added on the event params level, for example:<\/p>\n\n\n\n
{\n \"events\": [\n {\n \"name\": \"purchase\",\n \"params\": {\n \"items\": [\n {\n \"price\": 73,\n \"coupon\": \"banana\",\n \"item_id\": \"142959\",\n \"currency\": \"EUR\",\n \"quantity\": 1,\n \"item_name\": \"my cool product\",\n }\n ],\n \"value\": 73,\n \"coupon\": null,\n \"currency\": \"EUR\",\n \"debug_mode\": 1,\n<\/strong> \"session_id\": \"1704269295\",\n \"page_location\": \"https:\/\/trackingchef.com\/offline-events\",\n \"transaction_id\": \"140070\"\n }\n }\n ],\n \"user_id\": \"184\",\n \"client_id\": \"1054051101.1678866116\"\n}<\/code><\/pre>\n\n\n\nOnce added, these events will show in the DebugView report. Unlike the debug endpoint, these events will be processed and show in regular reports.<\/p>\n\n\n\n
In the DebugView you can now check that the event’s payload came in properly formatted, that ecommerce items received all their parameters and so on.<\/p>\n\n\n
\n
Inspecting a specific event’s properties in DebugView<\/figcaption><\/figure><\/div>\n\n\n\nImportant note:<\/strong> Do not leave the debug_mode:1 parameter on all incoming MP hits. Though this won’t damage data (as hits are still processed) it will substantially increase the number of debug devices active, making actual debugging of events difficult to handle.<\/p>\n<\/blockquote>\n\n\n\nConnecting the DebugView to an online session<\/h2>\n\n\n\n In order for the MP hit to connect with a live session, for both debugging and attribution purposes, the user’s Session ID must be sent as part of the payload (as an event param). The full details on fetching and sending this value can be found on this post<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"Google Analytics 4 (GA4) has seen a revised Measurement Protocol (MP), that is still somewhat lagging behind on features that seemed trivial in UA. One place it does (somewhat) shine is the debugging options it features. In this post I’ll try to walk you through them. The issue with debugging GA4 MP Hits sent to […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[136,135],"class_list":["post-5815","post","type-post","status-publish","format-standard","hentry","category-google-analytics","tag-google-analytics-4","tag-measurement-protocol"],"_links":{"self":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/5815","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/comments?post=5815"}],"version-history":[{"count":2,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/5815\/revisions"}],"predecessor-version":[{"id":5821,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/5815\/revisions\/5821"}],"wp:attachment":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/media?parent=5815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/categories?post=5815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/tags?post=5815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}