user1781040
user1781040

Reputation: 291

Integrate Google Analytics Tracking Into IOS App

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

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

cf. https://developers.google.com/analytics/devguides/collection/ios/v2/

into my code to tracking my view contact

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.trackPageView = @"Contact Screen";
    //
}

A have this error "Property 'TrackPageView' not found on object of the type 'ContactViewController'"

Upvotes: 4

Views: 4892

Answers (3)

imti
imti

Reputation: 1293

If you use Automatic Screen Tracking then you have to do this way:

@Objective C:

  1. Add #import "GAITrackedViewController.h" into XXX.h file
  2. extending current class from GAITrackedViewController [Eg. @interface ClockViewController : GAITrackedViewController]
  3. Add this line into XXX.m file's viewDidLoad() method self.screenName = @"Login";

Note: Hope you initialize and configured GAI properly into your project.

Upvotes: 0

whtlnv
whtlnv

Reputation: 2207

Today I got the same error, and despite what the setup documentation stated, the property is called screenName. so Just write this line in your viewDidLoad:

self.screenName = @"A name";

Upvotes: 14

Suhail Patel
Suhail Patel

Reputation: 13694

You are trying to set the wrong property (trackPageView) in your viewDidLoad: where you should actually be setting the trackedViewName property. The code should be as follows:

self.trackedViewName = @"Contact Screen";

Also in your header (.h) file, make sure your @interface inherits from the GAITrackedViewController class like so:

@interface YourContactScreenController : GAITrackedViewController

Upvotes: 1

Related Questions