Search code examples
google-analyticsmeasurement-protocol

Setting debug_mode with Measurement Protocol (GA4)


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!


Solution

  • 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 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
          }
        }
      ]
    }