2

I'm using the Measurement Protocol to push data to Google Analytics.

The protocol reference says that the endpoint (http://www.google-analytics.com/collect) always returns 200 OK, even if your message was malformed and/or ignored.

If my message is ignored, how do I know what I did wrong? Trial and error?

For example, the parameter reference says that Application Name ("an=Name") is an optional parameter for web properties. However, if I add this my requests, Google starts ignoring them completely. Why? More importantly, how can I find out why on my own? Is there a log the Google Analytics portal somewhere?

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
Mud
  • 28,277
  • 11
  • 59
  • 92

1 Answers1

2

You can debug Measurement Protocol hits with the Measurement Protocol Hit Builder.

This tool works by sending hits to the Measurement Protocol Validation Server behind the scenes to validate the hits and report error messages. The document linked here goes into more detail on how to send hits to this service manually if you wanted.

Philip Walton
  • 29,693
  • 16
  • 60
  • 84
  • The hit builder says "Hit is valid!". Yet Google Analytics ignores it. Here's the actual message (slightly sanitized): `v=1&tid=UA-XXXXXXXX-1&cid=561d0e8f-d99e-4542-8208-bad5a4c03f10&dh=hostname.com&an=testapp&t=pageview&dp=%2ftestpage&dt=testpage`. If I remove `&an=testapp`, GA processes it. If I leave it in, it doesn't. Supposedly this is a perfectly valid [optional parameter](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#an). – Mud Sep 24 '15 at 20:49
  • Are you sending these hits to an app view or a web view? – Philip Walton Sep 24 '15 at 23:00
  • Web view. The docs say that Application Name is required for an app view but [optional for a web view](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#an). My particular web app is Silverlight app and I find the Application Name parameter useful, but I can work around not using it. However, the larger question is how one gets insight to why Google Analytics is ignoring a message. – Mud Sep 24 '15 at 23:29
  • To answer your larger question, if GA is ignoring a hit that the Measurement Protocol Validation Server is saying is valid, that's a bug (and I'm looking into it). The MPVS is how you're supposed to be able to find these things out on your own. That's the whole point of the tool. – Philip Walton Sep 24 '15 at 23:35
  • Did you find out if there is a problem, either in GA itself or the documentation? – Mud Oct 01 '15 at 20:20