Warm tip: This article is reproduced from serverfault.com, please click

Setting debug_mode with Measurement Protocol (GA4)

发布于 2020-12-01 16:00:07

Can't find a way to set the debug_mode parameter using Measurement Protocol 4. Tried to put it everywhere (and naming it all i can think of) but without luck :) Documentation is still very light and doesn't mention the debug_mode. With web/js and GA4 it works fine!

Questioner
bang
Viewed
0
bang 2020-12-02 07:36:50

Weird. Suddenly the debug mode started to work with code I'm 100% sure didn't work before.

Adding the parameter debug_mode = true to the measurement protocol 4 request will make it show up in analytics DebugView.

Sample json payload that works:

{
  client_id: 'XXXXXXXXXX.YYYYYYYYYY',
  events:
  [{
    name: 'page_view',
    params:
    {
      page_location: '....',
      page_path: '....',
      page_title: '....',
      debug_mode: true
    }
  }]
}