gpt4 book ai didi

ios - 我如何使用 Google Analytics 跟踪用户对 MFMailComposeViewController 的操作?

转载 作者:行者123 更新时间:2023-11-29 10:49:22 25 4
gpt4 key购买 nike

如何使用 Google Analytics 跟踪用户使用 MFMailViewController 执行的操作?我想看看人们是如何使用它的;即按取消、发送电子邮件、删除消息等。

最佳答案

在您的委托(delegate)中实现以下方法:

- (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;
}
}

关于ios - 我如何使用 Google Analytics 跟踪用户对 MFMailComposeViewController 的操作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21105731/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com