1

I would like to Integrate Google Analytics Tracking into my IOS APP.

I have integrated Google Analytics Library and Add It To my Application.

Here is my code snippet,

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

   [UIApplication sharedApplication].statusBarHidden = NO;

    [GAI sharedInstance].trackUncaughtExceptions = YES;
    [GAI sharedInstance].dispatchInterval = 1;
    [GAI sharedInstance].debug=YES;
    [[GAI sharedInstance] trackerWithTrackingId:@"UA-43556575-1"];

    return YES;
}

Code In my FirstViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.trackedViewName = @"Home";
    ....
    ....
}

List of Librarys which i have added, (First i have copied all this library from download folder then added to my project folder and then in Xcode i am taking reference from project folder)

  • GAI.h
  • GAITrackedViewController.h
  • GAITracker.h
  • GAITransaction.h
  • GAITransactionItem.h
  • libGoogleAnalytics.a

Almost 5 days and still stuck with same problem :(

: Please Help ...

Thank you for reading and thanks in advance.

Krunal
  • 6,440
  • 21
  • 91
  • 155
  • Check my answer in this : [stack link][1] [1]: http://stackoverflow.com/questions/18829584/google-analytics-in-ios-not-working/18829940?noredirect=1#comment28055770_18829940 – Magyar Miklós Sep 24 '13 at 22:53

1 Answers1

1

I think this may be one case. Your UIViewController class must be a subclass of the GAITrackedViewController class,

@interface FirstViewController : GAITrackedViewController

And Must override these function.

-(void)viewDidLoad
{
  [super viewDidLoad];
  self.trackedName = @"Home";

  // your code here
}

-(void)viewDidAppear:(BOOL)animated
{
  [super viewDidAppear:animated];

  // your code here
}

As viewDidLoad and viewDidAppear: are important methods.

And Remember the profile must be for mobile app.

Buntylm
  • 7,345
  • 1
  • 31
  • 51
  • Yes My `FirstViewController` is subclass of `GAITrackedViewController ` and i also wrote `viewDidLoad:` and `viewDidAppear:` methods in my class – Krunal Sep 04 '13 at 10:44
  • yes, i have created new profile in google analytics, i just tried this all code in new SampleProject it works but it doesn't works in my project. showing `duplicate symbol _GAILogDebug in` ERROR. – Krunal Sep 04 '13 at 10:52
  • as i know `duplicate symbol` reason if you ncluded the `.m` file instead of the header `.h` – Buntylm Sep 04 '13 at 10:59
  • where should i check for duplicates ? means in which `ViewController` ? – Krunal Sep 04 '13 at 11:03
  • I have included only `.h` files in all `ViewController` – Krunal Sep 04 '13 at 11:10