前提・実現したいこと
monaca で作成したハイブリッドアプリに google-analytics-plugin
プラグインを導入し、Google Analytics で解析できるようにしたいです。
発生している問題・エラーメッセージ
下記サイトを参考にして、monacaアプリ に google-analytics-plugin
を導入しました。
Google Analyticsプラグインを使ってアプリの行動分析を行おう | モナカプレス
違う点は、パッケージ名指定ではなく、4/1時点のzipでインストールした事です。
#パッケージ名で指定すると、OSアイコンがどれも黒くならなかった為。
エラーメッセージのようなものは出力されませんが、Google Analytics のリアルタイムに反映されません。
プロパティの作成は4/1頃で、同時期に作成した別のサイト用Analyticsには既にリアルタイム反映がされているので、作成して間もないという事もありません。
google-analytics-plugin
の debugMode
を指定し、adbでログを出力してみましたが、データの送信そのものはされているように見受けられます。
ただ、その前に複数回Google Analyticsの starting up
が走っているようです。
該当のソースコード
script.js
1var myApp = angular.module('MyApp', ['onsen', 'ui.router']); 2 3myApp.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) { 4 5 $stateProvider 6 .state('page-A', { 7 url: '/pageA', 8 templateUrl: 'pageA.html', 9 onEnter: ['$rootScope', function($rootScope) { 10 console.log("page-A"); 11 window.ga.trackView("page-A"); 12 }] 13 }) 14 .state('page-B', { 15 url: '/pageB', 16 templateUrl: 'pageB.html', 17 onEnter: ['$rootScope', function($rootScope) { 18 console.log("page-B"); 19 window.ga.trackEvent("page-B", "click"); 20 }] 21 }) 22 }]); 23 24document.addEventListener('deviceready', function() { 25 window.ga.debugMode(); 26 window.ga.startTrackerWithId('UA-99999999-10', 30); 27 window.ga.setAppVersion('0.0.1'); 28});
adb
1C:\Users\hoge>adb shell setprop log.tag.GAv4 DEBUG 2 3C:\Users\hoge>adb logcat -v time -s GAv4 4--------- beginning of crash 5--------- beginning of system 6--------- beginning of main 704-04 18:13:13.463 ?/SENTINEL_TAG(11383): SENTINEL_MSG_LIBCUTILS 804-04 18:13:13.463 ?/SENTINEL_TAG(11383): SENTINEL_MSG_LIBLOG 904-04 18:16:06.795 I/GAv4 (11835): Google Analytics 8.2.98 is starting up. To enable debug logging on a device run: 1004-04 18:16:06.795 I/GAv4 (11835): adb shell setprop log.tag.GAv4 DEBUG 1104-04 18:16:06.795 I/GAv4 (11835): adb logcat -s GAv4 1204-04 18:16:06.823 W/GAv4 (11835): CampaignTrackingReceiver is not registered, not exported or is disabled. Installation campaign tracking is not possible. See http://goo.gl/8Rd3yj for instructions. 1304-04 18:16:06.846 D/GAv4 (11835): setLocalDispatchPeriod (sec): 1800 1404-04 18:16:11.514 I/GAv4 (11813): Google Analytics 8.4.87 is starting up. To enable debug logging on a device run: 1504-04 18:16:11.514 I/GAv4 (11813): adb shell setprop log.tag.GAv4 DEBUG 1604-04 18:16:11.514 I/GAv4 (11813): adb logcat -s GAv4 1704-04 18:16:11.547 W/GAv4 (11813): AnalyticsReceiver is not registered or is disabled. Register the receiver for reliable dispatching on non-Google Play devices. See http://goo.gl/8Rd3yj for instructions. 1804-04 18:16:11.552 W/GAv4 (11813): CampaignTrackingReceiver is not registered, not exported or is disabled. Installation campaign tracking is not possible. See http://goo.gl/8Rd3yj for instructions. 1904-04 18:16:11.561 W/GAv4 (11813): AnalyticsService not registered in the app manifest. Hits might not be delivered reliably. See http://goo.gl/8Rd3yj for instructions. 2004-04 18:16:11.612 D/GAv4 (11813): setLocalDispatchPeriod (sec): 180 2104-04 18:16:11.749 I/GAv4 (12328): Google Analytics 8.1.15 is starting up. To enable debug logging on a device run: 2204-04 18:16:11.749 I/GAv4 (12328): adb shell setprop log.tag.GAv4 DEBUG 2304-04 18:16:11.749 I/GAv4 (12328): adb logcat -s GAv4 2404-04 18:16:11.766 W/GAv4 (12328): AnalyticsReceiver is not registered or is disabled. Register the receiver for reliable dispatching on non-Google Play devices. See http://goo.gl/8Rd3yj for instructions. 2504-04 18:16:11.770 W/GAv4 (12328): CampaignTrackingReceiver is not registered, not exported or is disabled. Installation campaign tracking is not possible. See http://goo.gl/8Rd3yj for instructions. 2604-04 18:16:11.775 W/GAv4 (12328): AnalyticsService not registered in the app manifest. Hits might not be delivered reliably. See http://goo.gl/8Rd3yj for instructions. 2704-04 18:16:11.891 D/GAv4 (12328): setLocalDispatchPeriod (sec): 10 2804-04 18:16:14.649 I/GAv4 (11813): GoogleAnalytics.setLogger() is deprecated. To enable debug logging, please run: 2904-04 18:16:14.649 I/GAv4 (11813): adb shell setprop log.tag.GAv4 DEBUG 3004-04 18:16:14.650 D/GAv4 (11813): AppOptOut is set to true. Not sending Google Analytics hit 3104-04 18:16:43.054 I/GAv4 (23045): Dry run enabled. Would have sent hit: ht=1522833403043, _v=ma11.9.10, a=803901981, aid=jp.sample.hogehoge.debugger, aiid=com.google.android.packageinstaller, an=FeeSche(Debugger), av=0.0.1, cd=page-A, cid=624a1917-1a13-4012-a6c8-3af8f2f767bd, sr=1080x1776, t=screenview, tid=UA-99999999-10, ul=ja-jp, v=1 3204-04 18:16:46.977 I/GAv4 (23045): Dry run enabled. Would have sent hit: ht=1522833406974, _v=ma11.9.10, a=803901982, aid=jp.sample.hogehoge.debugger, aiid=com.google.android.packageinstaller, an=FeeSche(Debugger), av=0.0.1, cd=page-A, cid=624a1917-1a13-4012-a6c8-3af8f2f767bd, ea=click, ec=page-B, el=, ev=0, sr=1080x1776, t=event, tid=UA-99999999-10, ul=ja-jp, v=1
試したこと
AngularJSを組み込んでいるため、$transitions.onBefore
や$transitions.onSuccess
内で、deviceready
イベントを追加もしてみましたが、反映されませんでした。
補足情報(FW/ツールのバージョンなど)
monaca: Proプラン
Cordova: 7.1.0
google-analytics-plugin: 1.8.7 (2018/03/26 release)
他Cordovaプラグイン:
- cordova-plugin-admobpro (plugin.xmlのgmsバージョンを修正)
- cordova-custom-config
- skwas-cordova-plugin-datetimepicker
- cordova-plugin-inappbrowser
- cordova-plugin-local-notification
- monaca-plugin-monaca-core
- cc.fovea.cordova.purchase
- cordova-plugin-x-socialsharing
- cordova-plugin-splashscreen
- cordova-plugin-statusbar
- cordova-plugin-whitelist
※上記プラグインを入れてない新規プロジェクトに、google-analytics-pluginだけ入れても反映されませんでした。
導入方法が悪いのか、コーディングが悪いのか、切り分けもできず、困っています。
解決策、調査方法、手がかり等、どのような小さな事でも構いませんので、何かご存じの方がいらっしゃいましたら、お手数をおかけして申し訳ありませんが、ご教授のほどよろしくお願いいたします。
あなたの回答
tips
プレビュー