Integration with other SDK
To get accurate attribution and analytics across all third-party SDKs, pass the Magify clientId into each SDK after the Magify client is set up.
Ordering rule
Always follow this sequence:
- Construct and configure
MagifyClient. - Call
magify.setup(). - Read
magify.clientId. - Pass the
clientIdinto every connected third-party SDK.
The clientId is fixed at construction time and is available immediately after step 1. However, you should call magify.setup() before propagating it so that the SDK is fully initialized and background synchronization starts with the correct identifier.
Use clientId for all integrations
import UIKit
import Magify
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
lazy var magify: MagifyClient = {
let configURL = Bundle.main.url(
forResource: "Magify-Config",
withExtension: "json"
)!
return MagifyClient(
for: "MyApplication",
defaultConfigURL: configURL,
isSandbox: false
)
}()
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
magify.setup()
let clientId = magify.clientId
// AppsFlyer
AppsFlyerLib.shared().customerUserID = clientId
// Adjust
let adjustConfig = ADJConfig(appToken: "{YourAppToken}", environment: ADJEnvironmentProduction)!
Adjust.addGlobalCallbackParameter(clientId, forKey: "client_id")
Adjust.addGlobalPartnerParameter(clientId, forKey: "client_id")
Adjust.initSdk(adjustConfig)
// AppLovin MAX
ALSdk.shared().userIdentifier = clientId
// LevelPlay — pass the user ID in the init request
let levelPlayInit = LPMInitRequestBuilder(appKey: "{YourAppKey}")
.withUserId(clientId)
.build()
LevelPlay.initWith(levelPlayInit) { _, _ in }
// RevenueCat
let revenueCatConfig = Configuration.Builder(withAPIKey: "your_api_key")
.with(appUserID: clientId)
.build()
Purchases.configure(with: revenueCatConfig)
return true
}
}
Sub-pages
- AppsFlyer — set
customerUserIDfor attribution; - Adjust — attach
client_idas global callback and partner parameters; - AppLovin MAX — set user identifier before MAX initialization;
- LevelPlay — pass the user ID in the LevelPlay init request;
- RevenueCat — pass
appUserIDon configuration; - Your own integration — pass your own trusted identifier into Magify as a custom
clientId.