Well, don’t you think this is somewhat interesting information for debugging the problem?
Please provide a list of installed plugins (ionic cordova plugin list) and packages (content of package.json). And best you also include the code you use for the Analytics plugin.
setTimeout() is virtually never the right answer. It is likely to result in unpredictable, difficult-to-reproduce race conditions. Please do not emulate the post above marked as the “solution”.
Instead, the call to trackView() should be placed in a then clause off the call to startTrackerWithId(), in order to be assured of proper execution order.
Let me be devil’s advocate here and anticipate the next question:
But what if I want to trackView() in other places, where there is no startTrackerWithId() call or I want to call trackView() multiple times in different places?
In one specific case, I got this error when the GA Analytics ID was blank. Interestingly, on iOS only, no amount of error handling prevented this from crashing the app. The fix was to simply make sure we always have a GA Analytics ID value.
e.g.
startTrackerWithId(’’).then(
errors on iOS only with message “tracker not started”