In Google Analytics documentation they provide the next code:
Is it possible to track a view without using heritage?
Thanks in advance!
In Google Analytics documentation they provide the next code:
Is it possible to track a view without using heritage?
Thanks in advance!
Yes, It is possible. After You setup your defaultTracker in AppDelegate didFinishLaunchingWithOptions method like this;
id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"your_tracking_id"];
[[GAI sharedInstance] setDefaultTracker:tracker];
You can use this in your class that is without heritage;
-(void)viewWillAppear:(BOOL)animated{
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker set:kGAIScreenName value:@"YourViewControllerName"];
[tracker send:[[GAIDictionaryBuilder createAppView] build]]; }