1
如何使用Google Analytics跟蹤用戶使用MFMailViewController進行的操作?我想看看人們是如何使用它的;即按取消,發送電子郵件,刪除消息等如何跟蹤使用Google Analytics的用戶使用MFMailComposeViewController進行的操作?
如何使用Google Analytics跟蹤用戶使用MFMailViewController進行的操作?我想看看人們是如何使用它的;即按取消,發送電子郵件,刪除消息等如何跟蹤使用Google Analytics的用戶使用MFMailComposeViewController進行的操作?
實現您的委託以下方法:
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
id tracker = [[GAI sharedInstance] defaultTracker];
switch (result) {
case MFMailComposeResultCancelled:
[tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"ui_action" action:@"event_action" // Event action (required)
label:@"Cancelled" // Event label
value:nil] build]]; // Event value
break;
case MFMailComposeResultSaved:
[tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"ui_action" action:@"event_action" // Event action (required)
label:@"Saved" // Event label
value:nil] build]]; // Event value
break;
case MFMailComposeResultSent:
[tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"ui_action" action:@"event_action" // Event action (required)
label:@"Sent" // Event label
value:nil] build]]; // Event value
break;
case MFMailComposeResultFailed:
[tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"ui_action" action:@"event_action" // Event action (required)
label:@"Failed" // Event label
value:nil] build]]; // Event value
break;
default:
break;
}
}