Problem sending mobile analytics to mobile phones

I have included Google mobile analytics in my iphone application, but for some reason, pageviews and events are not being sent.

I put this in my appDidFinishLaunching app delegation method (I have x'd UA string):

[[GANTracker sharedTracker] startTrackerWithAccountID: @ "UA-xxxxxx-x" dispatchPeriod: 10 delegate: self]; Error NSError *; [[GANTracker sharedTracker] trackPageview: @ "/ home" withError: & error];

This is the delegate method:

- (void) trackerDispatchDidComplete: (GANTracker *) tracking events Sent: (NSUInteger) eventsDispatched eventsFailedDispatch: (NSUInteger) eventsFailedDispatch {NSLog (@ "Google Analytics Manager: succeeded:% i, failed:% i", eventsDispatched, eventsFailed; }

which displays a message:

Submitting Google Analytics: Failed: 0, Failed: 190

Has anyone else encountered this problem?

+3
source share
2 answers

It turns out that all you have to do is uninstall the application and reinstall. After you register one incorrect page view (that is, one without a “/” at the beginning), nothing will be uploaded to google analytics

+8
source

Google Analytics stops sending data when you try to send an unformatted "URL", if it is not initiated with "/" or contains some specific characters, it will only return errors.

The best thing to do is make sure that you place an "/" at the beginning of your URL and before submitting, format the URL to avoid any problems by doing:

NSString* pageURLString = [pageURL stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]; 

By coding it with NSASCIIStringEncoding, it will format the URL correctly. The same can be used when tracking an event.

+3
source

Source: https://habr.com/ru/post/915957/


All Articles