我在尝试将Google Analytics添加到我的应用中。我正在使用Dan Wilson的Google Analytics插件。我没有收到任何错误,但我的Google Analytics信息中心根本没有更新。我错在哪里,Google Analytics插件不报告控制台中的用户
var googleanalyticsApp = angular.module('starter', ['ionic','ngCordova'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
if(typeof analytics !== undefined) {
analytics.startTrackerWithId("UA-872489XX-1");
console.log("Analytics Initialized");
} else {
console.log("Google Analytics Unavailable");
}
});
});
googleanalyticsApp.controller('ExampleController', function($scope,$cordovaGoogleAnalytics) {
function _waitForAnalytics(){
if(typeof analytics !== 'undefined'){
analytics.startTrackerWithId("UA-872489XX-1");
analytics.trackView('APP first screen');
console.log("Analytics in Controller");
}
else{
setTimeout(function(){
_waitForAnalytics();
},250);
}
};
_waitForAnalytics();
我已经在Device Ready和Controller中初始化Google Analytics。 CONSOLE.LOG状态为:
但我的仪表盘完全不
更新请,帮助我。
纠正我,如果我错过了一些代码,但我没有看到任何调用'trackView','trackEvent'或插件中包含的任何其他跟踪功能。所以......你期望什么被准确跟踪?另请注意,Google Analytics可能需要几个小时才能显示实际结果,但您可以尝试使用实时视图,但可以百分之百地确定它是否正常运行,并给它几小时的更新时间(会提示有现在再看一下,如果没有显示,请添加一些跟踪调用)! – OClyde
嗨@OClyde,我已经添加了TrackView(同时显示在代码中) –