我在嘗試將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(同時顯示在代碼中) –