Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrating Google Analytics easytracker in my iOS App

The description of easytracker it state the following:

   Use TrackedUIViewController to automatically emit pageviews when the view
// associated with the controller appears. 

And then if you look at the example they do the following:

#import "EasyTracker.h"

@interface FirstViewController : TrackedUIViewController

However in my case the interface look like this:

@interface MyTableViewController : UITableViewController<FBRequestDelegate,
FBDialogDelegate,UIGestureRecognizerDelegate>{
    User *user;
    Fam *fam;
}

what should I do to add the tracking?

like image 998
Mikael Avatar asked May 11 '12 05:05

Mikael


2 Answers

You can do a manual screens tracking here is google doc for it.

Manual Screen Tracking

To manually track a screen view, call trackView: as in the following example:

id<GAITracker> googleTracker = [[GAI sharedInstance] trackerWithTrackingId:@"YOUR-IUD"];
[googleTracker trackView:@"home screen"];
like image 134
Thomas Besnehard Avatar answered Oct 12 '22 00:10

Thomas Besnehard


Well, if you are trying to use a UITableViewController, that likely means you have a table view within your view controller. To keep that functionality, you need to create a table view yourself, and assign your view controller as the data source and delegate of that table view. That way, your view controller will continue to implement the table view's data source and delegate methods. I would suggest using Interface Builder, and dropping a table view onto MyTableViewController.

Your interface would then look something like this:

@interface MyTableViewController : TrackedUIViewController <UITableViewDataSource, UITableViewDelegate>

You'll also most likely find yourself needing to wire up the table view as a property on your view controller.

@property (strong) UITableView *tableView;
like image 29
kturner Avatar answered Oct 12 '22 01:10

kturner