[SOLVED] - iOS Google analytics issue

HI there,

My question is about the Cordova Google Analytics plugin used with iOS.
Everything installed just fine into my Android App, but iOS has been quite problematic!

BACKGROUND

Following the documentation [http://ngcordova.com/docs/plugins/googleAnalytics/]
I added $cordovaGoogleAnalytics into the function parameters of my controller and then attempted to kick things off withe the following command

$cordovaGoogleAnalytics.startTrackerWithId('UA-XXXXX-01');

When I build and ran (on device) I only the white screen of death.
(There isn’t any error output in my safari console at all.)
However if I leave $cordovaGoogleAnalytics in my function parameters and comment off the call to start tracking, then it all works again.

My question

Since the analytics plugin builds and runs on the app, I have assumed that this is not the root cause of my issue. Therefore I wondered if its likely to be caused by our old friend “App Transport Security”??
If so, how should I resolve this issue?
If not… does anyone else have an alternative suggestion.

My app uses the basic App Transport Security

<dict> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> <key>NSExceptionDomains</key> <dict/> </dict>

thanks in advance for any help you suggestions you are able to give.

Steve

Hi all,

I’ve solved my problem!!!

Amazingly it was simply a series of a few words in the documentation on Github, amongst the manual implementation instructions that provided the inspiration for my solution.
Without rambling on, for some reason it seems that iOS prefers (on my app, if not everyone else’s) the analytics code in the home controller to be wrapped in a ready wrapper …

`$ionicPlatform.ready(function() {

+analytics code here+

});`

All my other controller s were fine because only the home controller fired up immediately.

This solution may or may not work for you but it’s working like a charm on my app.
I thought I’d post up my solution just in case it helps any one else solve a similar issue.

thanks

Steve