简体   繁体   中英

Tracking events for universal iOS app with Google Analytics

I have an iOS app which is universal, for both iPhone and iPad. I want to use Google Analytics to track app usage. I would like to track a certain event, like a button press - but I want to see if there is a difference between event occurrence among iPhone and iPad users of my app. Does anybody know how to do that with Google Analytics? Does it track the platform automatically?

Thanks

You can track it by put tracking call based on your event with device type like

id tracker = [[GAI sharedInstance] defaultTracker];
[tracker set:kGAIScreenName value:[NSString stringWithFormat:@"Your Event %@",([[UIDevice currentDevice] userInterfaceIdiom]==UIUserInterfaceIdiomPad?@"iPad":@"iPhone")]];
[tracker send:[[GAIDictionaryBuilder createAppView] build]];

Which ultimate outcome tracker as

Your Event iPhone //in case device is iPhone
//OR
Your Event iPad //in case device is iPad

Google Analytics gives you the device-os, and several other information. May be include Device type.

HTH, Enjoy Coding!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM