Skip to content

Commit 11f9e78

Browse files
committed
CORE-1768 api for ATT prompt performance
1 parent e6f8cbc commit 11f9e78

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

Branch-SDK/Branch.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,16 @@ typedef NS_ENUM(NSUInteger, BranchCreditHistoryOrder) {
683683
*/
684684
- (void)setAppClipAppGroup:(NSString *)appGroup;
685685

686+
/**
687+
Pass the AppTrackingTransparency authorization status to Branch to measure ATT prompt performance.
688+
This method should be called from the callback of ATTrackingManager.requestTrackingAuthorization.
689+
690+
Note:
691+
Before prompting the user, check that ATTrackingManager.trackingAuthorizationStatus is notDetermined.
692+
Otherwise the prompt will not display and the completion will be called with current status. This will inflate the number of events shown in the Branch Dashboard.
693+
*/
694+
- (void)handleOptInStatus:(unsigned long)status;
695+
686696
/**
687697
Set time window for SKAdNetwork callouts. By default, Branch limits calls to SKAdNetwork to within 24 hours after first install.
688698
@@ -694,7 +704,7 @@ typedef NS_ENUM(NSUInteger, BranchCreditHistoryOrder) {
694704
Add a Partner Parameter for Facebook.
695705
Once set, this parameter is attached to install, opens and events until cleared or the app restarts.
696706
697-
See Facebook's documentation for details on valid parameters
707+
See Facebook's documentation for details on valid parameters0
698708
*/
699709
- (void)addFacebookPartnerParameterWithName:(NSString *)name value:(NSString *)value;
700710

Branch-SDK/Branch.m

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#import "BNCSKAdNetwork.h"
4545
#import "BNCAppGroupsData.h"
4646
#import "BNCPartnerParameters.h"
47+
#import "BranchEvent.h"
4748

4849
#if !TARGET_OS_TV
4950
#import "BNCUserAgentCollector.h"
@@ -969,6 +970,25 @@ - (void)setAppClipAppGroup:(NSString *)appGroup {
969970
[BNCAppGroupsData shared].appGroup = appGroup;
970971
}
971972

973+
- (void)handleOptInStatus:(unsigned long)status {
974+
BranchEvent *event;
975+
switch (status) {
976+
case 2:
977+
// denied
978+
event = [BranchEvent standardEvent:BranchStandardEventOptOut];
979+
break;
980+
case 3:
981+
// authorized
982+
event = [BranchEvent standardEvent:BranchStandardEventOptIn];
983+
break;
984+
default:
985+
break;
986+
}
987+
if (event) {
988+
[event logEvent];
989+
}
990+
}
991+
972992
- (void)setSKAdNetworkCalloutMaxTimeSinceInstall:(NSTimeInterval)maxTimeInterval {
973993
[BNCSKAdNetwork sharedInstance].maxTimeSinceInstall = maxTimeInterval;
974994
}

Branch-SDK/BranchEvent.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventUnlockAchievem
4545
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventInvite;
4646
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventLogin;
4747
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventReserve;
48+
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventOptIn;
49+
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventOptOut;
4850

4951
typedef NS_ENUM(NSInteger, BranchEventAdType) {
5052
BranchEventAdTypeNone,

Branch-SDK/BranchEvent.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
BranchStandardEvent BranchStandardEventInvite = @"INVITE";
4747
BranchStandardEvent BranchStandardEventLogin = @"LOGIN";
4848
BranchStandardEvent BranchStandardEventReserve = @"RESERVE";
49+
BranchStandardEvent BranchStandardEventOptIn = @"OPT_IN";
50+
BranchStandardEvent BranchStandardEventOptOut = @"OPT_OUT";
4951

5052
@implementation BranchEventRequest
5153

0 commit comments

Comments
 (0)