Supposedly, Google Analytics new Universal Analytics, allows Multi-platform tracking. It might be a misunderstanding of the actual location of where data will go. My use case is as follows:
据推测,谷歌分析新通用分析,允许多平台跟踪。这可能是对数据的实际位置的误解。我的用例如下:
I have a hybrid iOS app. An app with native screens and webview screens. I would like to track both types of screens into the same GA property.
我有一个混合的iOS应用,一个带有原生屏幕和webview屏幕的应用。我想把这两种类型的屏幕都记录到相同的GA属性中。
It is my understanding, according to these pages (https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide and https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#apptracking) that I should be able to track the webview screens into an "appView" profile. I should also be able to set up the app to track into this property as well.
根据这些页面(https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide和https://developers.google.com/analytics/devguides/collections/colltics/field -reference#apptracking),我应该能够跟踪webview屏幕到一个“appView”配置文件中。我也应该可以设置应用程序来跟踪这个属性。
However, in the process of just setting up the webview to dump into the appView profile, I get no traffic. I am able to see the the request fired via the GA debug Chrome add-on, but see no data in the GA real-time view.
然而,在设置webview以转储到appView配置文件的过程中,我没有获得任何流量。我可以看到通过GA debug Chrome扩展触发的请求,但是在GA实时视图中看不到数据。
The code I'm injecting is structured as:
我所注入的代码结构如下:
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-12345678-1');
ga('set', 'appName', 'FOO');
ga('set', 'appVersion', '0.0.0');
ga('send', {
'hitType':'appview'
});
</script>
<!-- End Google Analytics -->
The resulting information showing in the JS console from the GA debugger is
GA调试器在JS控制台中显示的结果信息是
adSenseId (&a) 655544961
apiVersion (&v) 1
appName (&an) Foo
appVersion (&av) 0.0.0
clientId (&cid) 742157966.1379522968
encoding (&de) windows-1252
flashVersion (&fl) 11.8 r800
hitType (&t) appview
javaEnabled (&je) 1
language (&ul) en-us
location (&dl) http://foo.com/
referrer (&dr)
screenColors (&sd) 24-bit
screenResolution (&sr) 1920x1080
title (&dt) Foo Title
trackingId (&tid) UA-12345678-1
viewportSize (&vp) 387x985
Which shows the request contains the required item, the hitType (appview, &t) when fired by the analytics.js file.
它显示请求包含所需的项,即分析触发时的hitType (appview, &t)。js文件。
Am I misunderstanding this usage? Should I only be able to go from the native iOS sdk into the universal tracker? Or is it possible to shoot data from the webview into the universal tracker as an appView?
我是否误解了这个用法?我应该只从本地iOS sdk转到通用跟踪器吗?或者可以将webview中的数据作为appView的形式拍摄到universal tracker中?
If it is possible, what is happening to my data?! Were is it going?
如果可能的话,我的数据发生了什么变化?都是吗?
1 个解决方案
#1
1
Appview tracking with analytics.js didn't work for me neither.
Appview跟踪与分析。js也不为我工作。
I ended up making plain POST requests to /collect
, according to the Measurement Protocol.
(Make sure you have CORS disabled in your ajax library, since Google analytics servers don't like OPTIONS requests)
根据测量协议,我最终提出了简单的请求/收集。(确保在ajax库中禁用了CORS,因为谷歌分析服务器不喜欢选项请求)
This way, my webviews (Android PhoneGap App) track to the same GA property as my native iOS App using Google Analytics SDK.
通过这种方式,我的webviews (Android PhoneGap App)可以使用谷歌Analytics SDK跟踪到与我的原生iOS应用相同的GA属性。
#1
1
Appview tracking with analytics.js didn't work for me neither.
Appview跟踪与分析。js也不为我工作。
I ended up making plain POST requests to /collect
, according to the Measurement Protocol.
(Make sure you have CORS disabled in your ajax library, since Google analytics servers don't like OPTIONS requests)
根据测量协议,我最终提出了简单的请求/收集。(确保在ajax库中禁用了CORS,因为谷歌分析服务器不喜欢选项请求)
This way, my webviews (Android PhoneGap App) track to the same GA property as my native iOS App using Google Analytics SDK.
通过这种方式,我的webviews (Android PhoneGap App)可以使用谷歌Analytics SDK跟踪到与我的原生iOS应用相同的GA属性。