Skip to main content
Powerhead13
Participant
May 1, 2013
Question

How to track devices in Google Universal Analytics from Air mobile application?

  • May 1, 2013
  • 3 replies
  • 4090 views

Hello,

I'm using Google Measurement Protocol to collect analytics data from mobile Air application

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

I found that Air application running on iPad 3 not detecting device model in google analytics reports.

I guess it's because Air environment sending incomplete user-agent string.

This is what it sending:

Mozilla/5.0 (iOS; U; ru) AppleWebKit/533.19.4 (KHTML, like Gecko) AdobeAIR/3.1

And this user-agent string sending by Safari on ipad (for comparison😞

Mozilla/5.0 (iPad; CPU OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B329 Safari/8536.25

So Air application knows much less than Safari.

My question is: How to create custom user-agent string in Air application so it contains enough data for google analytics to detect device model?

Is there any solution that will work on most ios and android devices?

This topic has been closed for replies.

3 replies

Inspiring
October 7, 2015

When sending a hit request to the measurement protocol from AIR
the TCP stack will use by default the AIR user-agent

you can override it with the ua parameter
see Measurement Protocol Parameter Reference  |       Analytics Measurement Protocol  |       Google Developerslso

you can also use a library that do that for you
check out as3-universal-analytics v0.8

a Google Universal Analytics implementation for ActionScript 3.0

Release First release v0.8 · zwetan/as3-universal-analytics · GitHub

Participant
May 16, 2013

Hello

I have tried implementing the google measurement protocol without success.

Despite the fact that I get the code 200 from the url request, nothing appears on the dashboard.

I have tried using different parameters following the google guidelines, but that does not change anything.

Of course I have verified the used account and that the parameters code are correctly indicated.

Any help would be greatly appreciated....

Participant
February 21, 2014

I don't know if you managed to make it work, but it kind of worked for me, I did this:

var _urlReq:URLRequest = new URLRequest('http://www.google-analytics.com/collect');

                              var uuid:String = 'my-generated-uuid';

                              _urlReq.method = URLRequestMethod.POST;

                              var scName:String = '&v=1&tid='+myTrackingCode+'&cid='+uuid+'&an='+myAppName+'&av=1.0&t=appview&cd='+myScreenName;

                              _urlReq.data = scName;

                              var urlLoader: URLLoader = new URLLoader();

                              urlLoader.load(_urlReq);

I say "it kind of worked" because I haven't been able to send custom events yet, butI'm on the right track.

Jeff__Ward
Inspiring
March 3, 2014

FYI, the POST method works from AIR, but fails from a browser because of cross-site-scripting rules.  I resolved this here:

http://stackoverflow.com/questions/22158310/using-google-analytics-measurement-protocol-universal-analytics-from-flash-a/

Inspiring
May 2, 2013

are you using sytem.Capabilities to detect device infos?

Powerhead13
Participant
May 2, 2013

Not yet.

But looks like I should.

I think I will use sytem.Capabilities to guess device model and set appropriate user-agent string from list.

But how many devices I can detect using this way? Can I detect ipad 1, 2, 3, 4?

Inspiring
May 2, 2013

But how many devices I can detect using this way? Can I detect ipad 1, 2, 3, 4?

How about trying out?