I would like to use GA for my Ionic 2 app but for hybrid applications it looks a little bit tricky.
In my app.component
I have:
this.platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
GoogleAnalytics.debugMode();
GoogleAnalytics.startTrackerWithId(this.config.googleAnalyticsId).then(() => {
console.log(this.TAG + ' ANALYTICS+');
}).catch((err) => {
console.log(this.TAG + ' ANALYTICS- ' + err);
});
GoogleAnalytics.enableUncaughtExceptionReporting(true)
.then((_success) => {
console.log(_success);
}).catch((_error) => {
console.log(_error);
});
...
And got such error log:
I: Google Analytics 10.2.98 is starting up. To enable debug logging on a device run:
adb shell setprop log.tag.GAv4 DEBUG
adb logcat -s GAv4
I: Logger is deprecated. To enable debug logging, please run:
adb shell setprop log.tag.GAv4 DEBUG
W: THREAD WARNING: exec() call to UniversalAnalytics.debugMode blocked the main thread for 57ms. Plugin should use CordovaInterface.getThreadPool().
W: Attempted to send a second callback for ID: UniversalAnalytics549833873
Result was: "Invalid action"
W: Attempted to send a second callback for ID: UniversalAnalytics549833875
Result was: "Invalid action"
I: [INFO:CONSOLE(16)] "Tracker not started", source: file:///android_asset/www/build/main.js (16)
The straightforward goal for me is to collect information about bugs during beta-testing. Because I didn’t find enough information about this quite new subject for me, any hints or best practices would be appreciated.