2

I am completely new to the Google Analytics Measurement protocol.

Trying to fetch the results and load it in iframe of an registered tid domain.

My query string looks something like this:

http://www.google-analytics.com/collect?v=1&tid=UA-XXX-1&cid=555&t=pageview&dp=%2Fauth"

But i get the response as : GIF89aÿÿÿÿ,D;

What am I doing anything wrong? I also tried passing domain name with it and its title. Still no success.

And also do I need to call this get or post from the origin domain or can I do it from Postman-Rest client?

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
Mithun Shreevatsa
  • 3,588
  • 9
  • 50
  • 95

2 Answers2

3

I think your having an issue with understanding what the Measurement Protocol is.

You said:

Trying to fetch the results and load it in iframe of an registered tid domain.

What the measurement protocol is for:

Measurement Protocol Overview The Google Analytics Measurement Protocol allows developers to make HTTP requests to send raw user interaction data directly to Google Analytics servers.

The measurement protocol is for sending hits to Google Analytics, If you want to get your Google Analytics data out you use the Reporting API

Response

The response you are getting back from the measurement protocol is good it means it recorded your message. GIF89aÿÿÿÿ,D;

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
  • Thanks @DalmTo once again – Mithun Shreevatsa Apr 30 '15 at 11:15
  • @DalmTo, final one : I assume by this we can keep track of the users visiting counter to the particular route with the ID passed. After this, the analytic's will be generated for each trigger to the respective route. So as you suggested, then we need to use Reporting API to display the calculated results. For this is it possible to display the same in Embed API in the charts? – Mithun Shreevatsa Apr 30 '15 at 12:10
  • 1) Remember the data isn't done processing for 24 hours, the number you get would be a few days old, you should fetch it at night and store it in your database someplace then just display that number all day. Before you ask the Real-time API doesn't work like that so its not a solution. TIp Check out service account authentication. 2) Embed API requires Oauth2 authentication, your users would be seeing there own Google analytics data not yours. – Linda Lawton - DaImTo Apr 30 '15 at 12:13
  • I have Oauth2 authentication enabled, moto is to report the number of visitors in the particular route of an vendor and from which user_agent. The vendor's are restricted for their routes. – Mithun Shreevatsa Apr 30 '15 at 12:19
1

What you're seeing is the content of the 1x1 GIF pixel that Google Analytics uses, which you can safely ignore. As long as the response code of your request is 200, you should be fine.

The origin domain of the request doesn't matter; you can—for instance—also send Measurement protocol requests from server-side scripts and it still works.

dorian
  • 5,667
  • 1
  • 19
  • 36