Avatar of rito1
rito1
 asked on

Google Analytics Measurement Protocol App/Screen tracking response GIF89a

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
Internet MarketingWeb DevelopmentWeb ApplicationsAnalytics

Avatar of undefined
Last Comment
Olaf Doschke

8/22/2022 - Mon
Olaf Doschke

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.
rito1

ASKER
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 Doschke

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.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
rito1

ASKER
ASKER CERTIFIED SOLUTION
Olaf Doschke

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
rito1

ASKER
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 Doschke

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.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
rito1

ASKER
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 Doschke

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.
rito1

ASKER
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 :-)
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
rito1

ASKER
Thank for your support.
Olaf Doschke

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.