How to use the Google Analytics measurement protocol correctly?

I am studying the use of Google Analytics for applications. For testing purposes, I created a new google account, turned on analytics for applications and issued the following command from the terminal for testing: it works:

curl "http://www.google-analytics.com/collect?v=1&tid=UA-12345678-1&cid=123&an=myapp&t=event&ec=action&ea=click" 

Unfortunately, this query does not affect any numbers that I see on the analytics page - all zeros. Any request to google analytics leads to the display of β€œ200 OK” and 1x1 pixels of gif, so I can’t understand the problem: is the request incorrect or do I need to pre-configure Google Analytics or it has a delay of days before the data is displayed, etc.

Any suggestions?

+6
source share
2 answers

It looks like your problem has been resolved. Some pointers for other people coming to this page:

  • View real-time reports.
  • Try sending a pageview or screen image instead of an event. They appear in other places.
  • cid must be UUID v4 .
+5
source

You can use this URL to debug your requests:

/ debug / assemble

instead

/ collect

You will see the details in the body of the response.

+3
source

All Articles