Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to correctly use google analytics measurement protocol?

I'm learning to use google analytics for apps. For test purpose i have created a new google account, enabled analytics for apps and issued following command from terminal to test is it working:

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 request don't affect any numbers i see on analytics page - it's all zeroes. Any request to google analytics results in "200 OK" and 1x1 pixel gif image, so i can't figure out the problem: is the request incorrect, or i need to somehow preconfigure google analytics, or it have days delay before data is displayed etc.

Any suggestions?

like image 824
grigoryvp Avatar asked Apr 06 '14 13:04

grigoryvp


People also ask

What is measurement protocol in GA?

The Google Analytics Measurement Protocol allows developers to make HTTP requests to send raw user interaction data directly to Google Analytics servers. This allows developers to measure how users interact with their business from almost any environment.

How does measurement protocol work?

The Measurement Protocol lets you send data to Analytics from any internet-connected device. It's particularly useful when you want to send data to Analytics from a kiosk, a point of sale system, or anything that is not a website or mobile app.


2 Answers

It looks like your issue was solved. Some pointers for other people coming to this page:

  • Look in realtime reports.
  • Try to send pageview or screenview instead of event. They show up in more places.
  • The cid should be a UUID v4.
like image 52
Avi Avatar answered Oct 22 '22 19:10

Avi


For debuging your requests you can use this URL:

/debug/collect

instead of

/collect

In response body you will see details.

like image 20
Alexander Suvorov Avatar answered Oct 22 '22 17:10

Alexander Suvorov