无法让Dan Wilson的Google Analytics插件正常运行

时间:2017-07-06 13:17:55

标签: angularjs ionic-framework google-analytics

我做错了什么?还需要什么?我已将Android平台添加到我的应用程序中,我将在Android Studio中导入并启动应用程序。但我无法在Analytics仪表板中看到任何更改。 插件: - cordova插件添加cordova-plugin-google-analytics [有cordova 5.0+]  app.js

     $ionicPlatform.ready(function() {
            document.addEventListener("deviceready", onDeviceReady, false);
            function onDeviceReady() {
              window.plugins.sim.getSimInfo(successCallback, errorCallback);
            }
            function successCallback(result) {
              console.log(result);
            }
            function errorCallback(error) {
              console.log(error);
            }
            // Android only: check permission
            function hasReadPermission() {
              window.plugins.sim.hasReadPermission(successCallback, errorCallback);
            }
            // Android only: request permission
            function requestReadPermission() {
              window.plugins.sim.requestReadPermission(successCallback, errorCallback);
            }
            if (window.cordova && window.cordova.plugins.Keyboard) {
                cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
            }
            if(ionic.Platform.isWebView()){ 

                var device_name     = device.name,
                    device_version  = device.version,
                    device_platform = device.platform;

                if (typeof analytics !== "undefined") {
                analytics.startTrackerWithId('UA-XXXXX-X'); // security purpose cannot give tracker_ID.
                analytics.trackView('home');// tracking home page
                analytics.trackView('partsearch'); //tracking part search page
                analytics.trackView('aggregates');// tracking aggregate page
                analytics.trackEvent("Affiliate", "Search");// check end of the code
                console.log("Starting Analytics");
                } else {
                console.log("Google Analytics plugin could not be loaded.")
                }
            }
    }

home.html
<div on-touch = "onTouchSearch()"  style="text-align:center;height:105px;padding:5px;vertical-align:middle;" class="waves-effect waves-light  no-margin" on-click="_gaq.push(['_trackEvent','Affiliate','Search']);">
//when search button is clicked on my app i want to see it in my google analytics dashboard

0 个答案:

没有答案