Skip to content

Conversation

NidhiDixit09
Copy link
Collaborator

Reference

EMT-1779 -- [iOS SDK] Provide setSafetrackAPIURL utility to override BNC_SAFETRACK_API_URL
https://branch.atlassian.net/browse/EMT-1779

Summary

Added new API - setSafetrackAPIURL. It overrides BNC_SAFETRACK_API_URL.
If app sets a custom safe track url and user opts in for IDFA collection (useTrackingDomain is true), this custom url will be used for all v2 requests, v1/open and v1/install.

Type Of Change

  • New feature (non-breaking change which adds functionality)

Testing Instructions

  • Verify all unit tests pass ( This PR adds two new tests - testSetSafeTrackServiceURLWithUserTrackingDomain and testSetSafeTrackServiceURLWithOutUserTrackingDomain)
  • Set a custom safetrack url using this new API - setSafetrackAPIURL in any test. Opt in for IDFA collection or manually set following params
    BNCServerAPI *serverAPI = [BNCServerAPI sharedInstance]; serverAPI.automaticallyEnableTrackingDomain = NO; serverAPI.useTrackingDomain = YES;

Verify SDK uses this custom safetrack URL as base URL for linking and v2 requests. A sample of expected URLs is added here https://branch.atlassian.net/browse/EMT-1779?focusedCommentId=620999

cc @BranchMetrics/saas-sdk-devs for visibility.

@NidhiDixit09 NidhiDixit09 changed the title Added API ssetSafetrackAPIURL Added API setSafetrackAPIURL Mar 5, 2025
}

//Check if user has set a custom API base URL / custom API safetrack base url
if (self.useTrackingDomain && self.customSafeTrackAPIURL){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So to confirm:
The if on line 98 is always true by default which means useTrackingDomain will always equal optedIntoIDFA. So then on line 103 the if checks if opted into idfa and use custom safe track url- so if using idfa and there is a custom safetrack url, use that. Else if not using idfa or no custom safe track url, use custom endpoint if available.

I think we'll want to simplify this logic further down.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gdeluna-branch Thats used for unit tests. we set this to NO in unit tests. Otherwise value set for self.useTrackingDomain is overriden by actual opted in status.



- (void)testSetSafeTrackServiceURLWithUserTrackingDomain {
NSString *url = @"https://links.tospotify.com";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove test urls with branding

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks !

@NidhiDixit09 NidhiDixit09 merged commit 59bcfa4 into master Mar 7, 2025
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants