• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

New Here ,
May 01, 2013 May 01, 2013

Copy link to clipboard

Copied

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?

TOPICS
ActionScript

Views

3.8K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
May 02, 2013 May 02, 2013

Copy link to clipboard

Copied

are you using sytem.Capabilities to detect device infos?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 02, 2013 May 02, 2013

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
May 02, 2013 May 02, 2013

Copy link to clipboard

Copied

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

How about trying out?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 16, 2013 May 16, 2013

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 21, 2014 Feb 21, 2014

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 03, 2014 Mar 03, 2014

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 23, 2015 Oct 23, 2015

Copy link to clipboard

Copied

Hey did you ever get the Event tracking sorted?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 26, 2015 Oct 26, 2015

Copy link to clipboard

Copied

Yeah, I did this:

var eventPayload:String = "v=1&tid="+GACode+"&cid=255&an="+appName+"&av=1.5.0&t=event&ec="+var1+"&ea="+var2+"&ev=1";


var1 and var2 are my device identifiers and screen identifier, but those are the values I decided to send, hopefully the string will give you and idea of how to begin. I haven't tried the Zwetan analytics library yet, but I guess it would be easier.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 26, 2015 Oct 26, 2015

Copy link to clipboard

Copied

LATEST

well it's not so much the "zwetan" library lol it's an implementation of the measurement protocol
by default google analytics will use the user-agent to determine the device
and the measurement protocol allow to override the user-agent which technically allow you to change the device.

see here ua parameter

But google warns about providing hand-crafted user-agent, if they don't recognise it they will ignore the request.


From what I tested, it does work, eg. you can send a request from a Linux server with the user-agent of a windows desktop browser and analytics will see the device or operating system as "windows".

For mobile device, it's possible to override too, but then you will have to detect the iPad 3 and have its user-agent ready to use, unlikely you could dynamically generate it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 07, 2015 Oct 07, 2015

Copy link to clipboard

Copied

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 Dev...lso

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines