We help IT Professionals succeed at work.

Google Analytics Measurement Protocol App/Screen tracking response GIF89a

2,224 Views
Last Modified: 2016-02-24
Hi All,

I am trying to implement screen tracking using the measurement protocol for the first time and I get the following response back from Google when performing a HTTP GET request:

GIF89a�����,D;

My GET requests are as follows:

v=1&tid=UA-57396443-1&cid=1234&an=Mobile+app&av=1.0.0&aid=com.myenterprise.myApp&t=screenview&cd=TitlePage&qt=193298751&sc=start&z=8501202

v=1&tid=UA-57396443-1&cid=1234&an=Mobile+app&av=1.0.0&aid=com.myenterprise.myApp&t=screenview&cd=Intro1&qt=193267065&z=1953001

v=1&tid=UA-57396443-1&cid=1234&an=Mobile+app&av=1.0.0&aid=com.myenterprise.myApp&t=screenview&cd=TitlePage&qt=193257961&sc=end&z=9035286

As you can see, my parameters include:

v
tid
cid
an
av
aid
t
cd
qt
sc
z

Has anyone seen this response before. Am I missing a parameter or passing a malformed value?

Could it be related to my user agent information?... I am implementing this tracking into the HTML of a Hybrid iOS app (HTML5 and xcode wrapper). At this point I am testing the tracking in Chrome rather than it being built into an IPA so the user agent is:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36

.. Could Analytics be expecting a different user agent for the hit type screenview?

Thanks,

Rit
Comment
Watch Question

Olaf DoschkeSoftware Developer
CERTIFIED EXPERT

Commented:
The response seems to be a gif image. So you have to use that parameterized URI as src of an image control.

It should be ok, just use it in the right context.

Bye, Olaf.

Author

Commented:
Hi Olaf,

I wasn't expecting a GIF back as the status and plus my page impressions are not appearing within the reports. This includes not showing in the real-time report either.

Do you have any other ideas what could be causing the issue with the payload I am sending?

Thanks,
Rit
Olaf DoschkeSoftware Developer
CERTIFIED EXPERT

Commented:
Wait for a google analytics expert, but as the resonse you get begins with GIF89a, it is a gif image, there's no doubt about that.

You don't tell us what base URL you're using to send this paramaters or payload, as you call it.

Bye, Olaf.
Software Developer
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Hi Olaf,

Thank you for your continued help.

As you can see from the type of data I am passing to Analytics, I want to capture screen impressions (not pages). Maybe its my misunderstanding but reading the overview of what the Measurement protocol is/does, this sounds right to me...

https://developers.google.com/analytics/devguides/collection/protocol/v1/ 

This is where I got me example payload data from which is part of the measurement protocol:

https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#screenView

How can I use this data for reporting?... what is the purpose of the measurement protocol otherwise?

If I want to be able to record screen impressions for my app that may be offline, so needs to be able to cache screen impressions and send them when a connection is available, what is the most appropriate approach?... I wanted to stay clear of using the iOS SDK to maintain my cross platform codebase.

Again, thank for you support.

Thanks,

Rit
Olaf DoschkeSoftware Developer
CERTIFIED EXPERT

Commented:
Again, this request is for adding to your statistics, reporting is not done by this request. It also exists as PUT request and then you don't get back a 1x1 pixel. To use this as GET request is for web applications or browser apps.

Before you can report when and how often you get page impressions, it has to be recorded, doesn't it? And this is the API and request used to record the impressions.

Reporting of results is done somewhere else.

Bye, Olaf.

Author

Commented:
Hi Olaf,

If I change it to a POST or PUT instead, I get a 405 method not allowed error. This is why I used the GET method. The GET method is allowed for recording the payload according to their docs:

https://developers.google.com/analytics/devguides/collection/protocol/v1/reference - within the Transport section titled 'GET'.

It might be, like you say, that the GET method returns a gif rather than the expected '2xx' status.

It doesn't seem to explain why I cannot see any screen impressions within the Analytics reporting interface.
Olaf DoschkeSoftware Developer
CERTIFIED EXPERT

Commented:
The docs say the GET request is available for situations you can't do a PUT request, that's fine.

The status is part of the response, but it's not in the response body. I don't know in what programming language you develop, but typically a http request has a response object with a response body (the GIF in this case), response headers plus some other properties, like the response status. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html

Bye, Olaf.

Author

Commented:
Hey Olaf, it works!... There seemed to be a delay in my Analytic account becoming active. I am ignoring the fact that its returning a gif... I can deal with then :-)

Author

Commented:
Thank for your support.
Olaf DoschkeSoftware Developer
CERTIFIED EXPERT

Commented:
You're welcome. As far as I googled xcode/objectiveC has a response class able to give you the statuscode.
The only time it would really matter is, if you want to repeat the request, wehen it fails from some client.

But yes, a GET request, whether used in an img html tag or a javascript xmlhttprequest or in any app code will return a 1x1 gif and you can also simply ignore it.

Bye, Olaf.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.