谷歌分析使用phonegap android没有数据显示

时间:2015-12-26 09:43:34

标签: android cordova google-analytics tracking


已整合来自here的Google解析插件。
我的Google解析帐户中没有数据显示。我正在启用互联网的Android设备上运行应用。
还安装了android SDK管理器的google play服务,给定了google-play-service项目的项目依赖项,在我的项目lib文件夹中添加了libGoogleAnalyticsServices.jar文件。 这是index.js的代码:

var app = {
      startTime: new Date().getTime(),
      initialize: function () {
        this.bindEvents();
      },
      bindEvents: function () {
        document.addEventListener('deviceready', this.onDeviceReady, false);
      },
      onDeviceReady: function () {
        app.receivedEvent('deviceready');
        app.testAll();
        app.setCampaignUrl("http://www.appfeel.com?utm_campaign=com.analytics.google&utm_source=github&utm_content=setCampaignFromUrl&utm_medium=link");
        app.setInstallerId("13456")
      },
      receivedEvent: function (id) {
        var parentElement = document.getElementById(id);
        var listeningElement = parentElement.querySelector('.listening');
        var receivedElement = parentElement.querySelector('.received');

        listeningElement.setAttribute('style', 'display:none;');
        receivedElement.setAttribute('style', 'display:block;');


        analytics.startTrackerWithId('my track id');
        alert("Start Time");
        analytics.trackTiming("app", "start", new Date().getTime() - app.startTime);
      },
      setInstallerId: function (id) {
          alert('installer id :'+id)
        var options = {};
        options[analytics.OPTIONS.APP_INSTALLER_ID] = id;
        analytics.setAppParams(options);
      },
      setCampaignUrl: function (url) {
          alert('campaign :'+url)
        analytics.setCampaignFromUrl(url); //"");
      },
      testAll: function () {
          alert('test all')
        var options = {};
        options[analytics.OPTIONS.APP_INSTALLER_ID] = "org.acme.app";
        analytics.setAppParams(options);

        alert("Set Campaign url");
        analytics.setCampaignFromUrl("http://www.appfeel.com?utm_campaign=com.analytics.google&utm_source=github&utm_content=setCampaignFromUrl&utm_medium=link");

      }
    };
    app.initialize(); 

感谢

0 个答案:

没有答案