Google IOS V3 analytics not logging in control panel

I wonder if anyone can help me, I'm trying to tune Google Analytics to my iOS project. I just need a very simple implementation to show the number of views loaded. I followed google docs ( https://developers.google.com/analytics/devguides/collection/ios/v3/ ) but nothing was updated in my dashboard

I have a property that does not tell users

My appdelegate is as follows

#import <UIKit/UIKit.h> #import "GAI.h" @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @property(nonatomic, strong) id<GAITracker> tracker; @end 

my.m contains - (BOOL) application: (UIApplication *) application didFinishLaunchingWithOptions: (NSDictionary *) launchOptions {

 [GAI sharedInstance].trackUncaughtExceptions = YES; // Optional: set Google Analytics dispatch interval to eg 20 seconds. [GAI sharedInstance].dispatchInterval = 20; // Optional: set Logger to VERBOSE for debug information. [[[GAI sharedInstance] logger] setLogLevel:kGAILogLevelVerbose]; // Initialize tracker. which i have set up at the top of my .mn self.tracker = [[GAI sharedInstance] trackerWithTrackingId:kTrackingId]; return YES; } 

And the page on which I am trying to record the import metrics #import "GAI.h" #import "GAIDictionaryBuilder.h"

and contains the following method

 -(void)viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; id tracker = [[GAI sharedInstance] defaultTracker]; // This screen name value will remain set on the tracker and sent with // hits until it is set to a new value or to nil. [tracker set:@"&cd" value:@"Home Screen"]; // manual screen tracking [tracker send:[[GAIDictionaryBuilder createAppView] build]]; } 

I do not see any errors, I get the console initial log

NFO: GoogleAnalytics 3.02 - [GAIReachCheckerFlagsChanged Reach:] (GAIReachCheckChecker.m: 159): Updating Reach Flags: 0X000002

But I get nothing in the dashboard

I also tried the Auto method specified at ( https://developers.google.com/analytics/devguides/collection/ios/v3/screens ), however this complained about the lack of a screen name

It drives me crazy! Any help would be appreciated!

UPDATE

Using the example included in the SDK, I was able to get the initial load for registering with google - note that this is different from google documentation:

Appdelegate

  NSDictionary *appDefaults = @{kAllowTracking: @(YES)}; [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults]; // User must be able to opt out of tracking [GAI sharedInstance].optOut = ![[NSUserDefaults standardUserDefaults] boolForKey:kAllowTracking]; // Initialize Google Analytics with a 120-second dispatch interval. There is a // tradeoff between battery usage and timely dispatch. [GAI sharedInstance].dispatchInterval = 120; [GAI sharedInstance].trackUncaughtExceptions = YES; self.tracker = [[GAI sharedInstance] trackerWithName:@"ios app name" trackingId:kTrackingId]; 

I used automatic screen tracking for the initial view controller according to google docs, however this only works on the initial loaded view controller, subsequent views using the same method are not logged.

And now my problem is that the APPdelegate method only works in the “didFinishLaunchingWithOptions application”, which will only work if the application terminates each time by putting the same code in the “applicationWillEnterForeground”, it doesn’t work - so frustrating - also tried to

  self.tracker = [[GAI sharedInstance] defaultTracker]; [self.tracker set:kGAISessionControl value:@"start"]; 

which apparently has no effect:

+8
ios iphone google-analytics-api
source share
1 answer

I think your error occurs when setting up the file name:

[set of trackers: @ "& cd" Value: @ "Home screen"];

You need to install kGAIScreenName for it to work. I do not mean @ "& cd", but kGAIScreenName:

 // This screen name value will remain set on the tracker and sent with // hits until it is set to a new value or to nil. [tracker set:kGAIScreenName value:@"Home Screen"]; [tracker send:[[GAIDictionaryBuilder createAppView] build]]; 

I hope this helps

0
source share

All Articles