Google Analytics for iOS track to multiple account for same event

旧城冷巷雨未停 提交于 2019-12-10 03:19:12

问题


I have two different web property id from two different accounts, say UA-1111-11, UA-2222-22 Now, in my iOS app, I need to log to both of them in the events. Is this even possible? If not, is there any workaround?

Here is my high level scenario: I have an existing app where I use google analytics UA-1111-11 to track. Now, I had an agreement with company X (they have UA-2222-22). They told me that I need to send analytics tracking events to their account (UA-2222-22) from my app (and I want to keep UA-1111-11 for my own use).


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/10563675/google-analytics-for-ios-track-to-multiple-account-for-same-event

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