google-analytics-plugin: Tracker not started - only iOS - Ionic2
Hello - everything works fine on Android but the Tracker is not starting on iOS.
import {GoogleAnalytics} from 'ionic-native';
platform.ready().then(() => {
StatusBar.styleDefault();
// --- Google Analytics ---
//GoogleAnalytics.debugMode();
GoogleAnalytics.startTrackerWithId("UA-XXXXXXXX-X"); //I replaced it with my ID
GoogleAnalytics.enableUncaughtExceptionReporting(true)
.then((_success) => {})
.catch((_error) => {
console.log("ERROR Google Analytics:", _error)
})
});
Error: Tracker not started
Thanks for help 😃
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 39
@martingra Don’t downgrade the plugin and simply set your ionic-native to 2.2.16 in your package.json (
"ionic-native": "2.2.16"), then runnpm iin your terminal.Instead of downgrading the plugin from 1.7.x to 1.6.0, updating
ionic-nativeto 2.2.16 did the trick.Ok, looks like the latest version is buggy. 1.6.0 does the trick! call trackEvent after startTrackerWithId is resolved and it works 👍
Thanks @peterpeterparker & @fttx for your help!
1.6.0 😉
here you go @victorsosa
I created a service like this. But note, funny thing, since I always use that service to track my event, the plugin itself is always defined, so I don’t face the above error anymore and I could say that most of the following code (like saving stuffs in array to send these events later) isn’t use…but who knows what will happens on each devices
Ok, Thanks you guys for the inside; 1.7.0 signature changed to window.ga.startTrackerWithId(‘UA-XXXX-YY’, 30) where 30 is the interval period. Maybe this is the root cause of the problem; Have anyone check the android logcat for errors? (It seems like this is not working only on Android)
@peterpeterparker I added the code for trackEvent method in your service: https://github.com/fttx/barcode-to-pc-app/blob/master/src/providers/google-analytics.ts
If i downgrade to 1.6.0 it works! What’s your plugin version?
Thanks, this will help other to create their own using Ionic 2. I myself use Ionic 1 yet.