Methods

Learn all the available methods for iOS you utilize with ATS Mobile SDK.

📘

Each method with a callback has async / await counterpart which is available for iOS 15 and above.

This article lists all the available methods you can call with ATS Mobile SDK. Some methods listed are part of beta features and are not available out-of-the-box. Talk to your LiveRamp representative to learn more about these features.

To view the list of error codes and how to troubleshoot them, see "ATS Mobile SDK Error Codes".

initialize

To use the ATS SDK, the initialization method needs to be called to start initialization process. For more information, see initialize the iOS SDK.

Parameters

NameTypeDescription
configurationLRAtsConfigurationThe object that contains an Config ID.
completionLRInitializeCompletion

(success: Bool, error: Error?)
Completion handler to call when initialization process is finished.

syncFilters

🚧

This Method is Only Available in Closed Beta

ATS On-device is only available in closed beta and their methods will not work out-of-the-box.

If you want to be part of the closed beta release, contact your LiveRamp administrator to get ATS On-device enabled.

This method synchronizes the Bloom filter based on whether a configuration has changed and new Bloom filters are available to download. The result is LRSyncFiltersCompletion with LRBloomFilterSyncStatus which contains information if the synchronization was full, partial or if there was an error.

Parameters

NameTypeDescription
completionLRSyncFiltersCompletion

(LRBloomFilterSyncStatus)
The completion handler to call when the Bloom filter has completed synchronization.

Returns

No return parameter

getDealIDs

🚧

This Method is Only Available in Closed Beta

ATS On-device is only available in closed beta and their methods will not work out-of-the-box.

If you want to be part of the closed beta release, contact your LiveRamp administrator to get ATS On-device enabled.

Based on a user identifier, this method returns asynchronously-delivered LRGetDealIDsCompletion with LRDealIDsResult that contains result status (status: DealIDsResultStatus) which can be offline, partial or full and array of generated dealIDs (dealIds: [String]).

To retrieve a valid Deal IDs, your ATS placement must be in an approved state. If the placement is unapproved, the SDK will return fake data which should only be used for testing. Information regarding the placement status can be found in the log output of the SDK.

Parameters

NameTypeDescription
userIdentifierLRDealIdentifierNon-hashed or SHA256-hashed email for which LRDealIDsResult is requested.
completionLRGetDealIDsCompletion

(LRDealIDsResult)
Completion handler to call when LRDealIDsResult is created.

Returns

No return parameter

getEnvelope

This method returns envelope for the specified identifier. Note that phone numbers must be normalized before passing to the SDK.

To retrieve a valid envelope, your ATS placement must be in an approved state. If the placement is unapproved, the SDK will return fake data which should only be used for testing. Information regarding the placement status can be found in the log output of the SDK.

🚧

To retrieve envelopes, the bundle ID of your application (tied to your placement) must first be approved by a LiveRamp representative.

Parameters

NameTypeDescription
lrIdentifierDataChoose one of the following (do not use LRIdentifierData directly):
LREmailIdentifier
LRHashedEmailIdentifier
LRPhoneIdentifier
LRCustomIdentifier
LREnvelopeIdentifier
Non-hashed or hashed identifier for which the envelope is requested.

Phone numbers must be normalized before passing to the SDK. See Phone Number Normalizations.
completionLRGetEnvelopeCompletion

(_ envelope: LREnvelope?, _ error: LRError?)
Completion handler to call when the envelope retrieval is completed.

Returns
No return parameter

See the following examples:

let lrEmailIdentifier = LREmailIdentifier("[email protected]")
LRAts.shared.getEnvelope(lrEmailIdentifier) { result, error in
    guard let envelope = result?.envelope else {
        print("Couldn't retrieve envelope. Error: \(error)")
        return
    }
    print("Received envelope: \(envelope)")
}
do {
    let lrEmailIdentifier = LREmailIdentifier("[email protected]")
    let envelope = try await LRAts.shared.getEnvelope(lrEmailIdentifier)
    print("Received envelope: \(envelope)")
} catch {
    print("Couldn't retrieve envelope. Error: \(error)")
}

📘

You can verify if an envelope has been successfully fetched by using a network HTTP proxy tool (such as Charles), and filter for the api.rlcdn call.

getEnvelope (completion: LRGetEnvelopeCompletion)

This method returns stored envelope without passing any identifiers. To use this method, the envelopes must already be stored in the local database.

Parameters

NameTypeDescription
completionLRGetEnvelopeCompletion

(_ envelope: LREnvelope?, _ error: LRError?)
Completion handler to call when the envelope retrieval is completed.

Returns
No return parameter

See the following examples:

LRAts.shared.getEnvelope() { result, error in
    guard let envelope = result?.envelope else {
        print("Couldn't retrieve envelope. Error: \(error)")
        return
    }
    print("Received envelope: \(envelope)")
}
do {
    let envelope = try await LRAts.shared.getEnvelope()
    print("Received envelope: \(envelope)")
} catch {
    print("Couldn't retrieve envelope. Error: \(error)")
}

resetSDK

Calling this method will remove all data related to LRAtsSDK. To use the SDK after calling this method, you have to go through the initialization process again.

Parameters
No parameters

Returns
No return parameter

logeCST

This method logs eCST data to the server. To call this method successfully, the SDK must be in ready state and an envelope must be present.

NameTypeDescription
eCSTDataLReCSTDataThe object that accepts eCST data and uses it to log eCSTForEnvelope
completionLRLogeCSTCompletion

(\_ error: Error?)
Completion handler to call when eCST data logging is completed.

Returns
No return parameter

See the following examples:

let eCSTDict: [String : Any] = ["Category": "Electronics"]
let eCSTData = LReCSTData(jsonDict: eCSTDict)
 LRAts.shared.logeCST(with: eCSTData) { error in
  print(error)
 }
let eCSTDict: [String : Any] = ["Category": "Electronics"]
let eCSTData = LReCSTData(jsonDict: eCSTDict)
do {
    let result = try await LRAts.shared.logeCST()
    print("Result: \(result)")
} catch {
    print("Couldn't post the eCST data. Error: \(error)")
}

invalidateCache

📘

This method is only available from v3.1.0 onwards.

The InvalidateCache method is now available for iOS and Android versions of LRAtsSDK. This method clears all cached envelope data maintained by the SDK, forcing it to fetch fresh data. It uses a lock to ensure that only one cache invalidation operation can run at a time. If the SDK is disabled, it logs a warning.

🚧

Use with Caution

The InvalidateCache method should be used with caution, as frequent cache invalidation may lead to increased network usage due to more frequent envelope fetches.

Parameters
No parameters

Returns
No return parameter