Google Analytics for iOS track to multiple account for same event

我怕爱的太早我们不能终老 提交于 2019-12-05 03:56:16

Google is working on their v2 SDK for iOS and Android, and they added a feature for multiple trackers in the same application. Currently, you can download Google Analytics v2 beta 3 for iOS, and start playing with it.

Check Google Analytics SDK

Sample code:

#import "RootViewController.h"
#import "GAI.h"

@interface RootViewController ()

@end

@implementation RootViewController
{
- (void)viewDidLoad {
  [super viewDidLoad];

  // Send a screen view to the first property.
  id tracker1 = [[GAI sharedInstance] trackerWithTrackingId:@"UA-XXXX-Y"];
  [tracker1 sendView:@"/HomeScreen"];

  // Send another screen view to the second property.
  id tracker2 = [[GAI sharedInstance] trackerWithTrackingId:@"UA-XXXX-Z"];
  [tracker2 sendView:@"Home"];
}

@end

Keep in mind that automated measurement features, like automatic screen and uncaught exception measurement, will only use one tracker to send data to Google Analytics. If you are using these features and want to send data using other trackers, you will need to do so manually.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!