Adjust class

The Adjust class can be used to send information about your application and users to Adjust. This can be used for attribution as well as for tracking of events for analytics.

Methods

Send callback parameters for each session

You can send callback parameters with each session recorded by the Adjust SDK. You can add extra parameters by calling on this method multiple times.

+ (void) addSessionCallbackParameter: (nonnull NSString *) key
                               value: (nonnull NSString *) value
Objective-C
Swift
Javascript
[Adjust addSessionCallbackParameter:@"foo" value:@"bar"];

Remove session callback parameters

If you have added a session parameter, you can remove it at a later time. To do this, pass the parameter key to the removeSessionCallbackParameter method.

+ (void) removeSessionCallbackParameter: (nonnull NSString *) key
Objective-C
Swift
Javascript
[Adjust removeSessionCallbackParameter:@"foo"];

Reset all session callback parameters

If you have added session callback parameters, you can remove them all at a later time. To do this, call the resetSessionCallbackParameters method.

+ (void) resetSessionCallbackParameters
Objective-C
Swift
Javascript
[Adjust resetSessionCallbackParameters];

Send callback parameters for each session to network partners

You can send callback parameters to partners with each session recorded by the Adjust SDK. You can add extra parameters by calling on this method multiple times.

+ (void) addSessionPartnerParameter: (nonnull NSString *) key
                              value: (nonnull NSString *) value
Objective-C
Swift
Javascript
[Adjust addSessionPartnerParameter:@"foo" value:@"bar"];

Remove callback parameters for partners

If you have added a partner parameter, you can remove it at a later time. To do this, pass the parameter key to the removeSessionPartnerParameter method.

+ (void) removeSessionPartnerParameter: (nonnull NSString *) key
Objective-C
Swift
Javascript
[Adjust removeSessionPartnerParameter:@"foo"];

Reset all callback parameters for partners

If you have added partner parameters, you can remove them all at a later time. To do this, call the resetSessionPartnerParameters method.

+ (void) resetSessionPartnerParameters
Objective-C
Swift
Javascript
[Adjust resetSessionPartnerParameters];

Get the Adjust ID for a device

You can return the Adjust ID (adid) of a user's device by calling the adid method.

Note:
The adid is only available after the installation has been successfully tracked.
+ (NSString *) adid
Objective-C
Swift
Javascript
NSString *adid = [Adjust adid];

Returns

Verify the app launched correctly

To initialize the SDK, you need to verify that your application launched properly. To do this, you can pass your ADJConfig object to the appDidLaunch method:

Note:
Call this at the end of your `didFinishLaunching` or `didFinishLaunchingWithOptions` method.
+ (void) appDidLaunch: (nullable ADJConfig *) adjustConfig
Objective-C
Swift
Javascript
[Adjust appDidLaunch:adjustConfig];

Parameters

Handle App Tracking Transparency choices

The Adjust SDK includes a wrapper built on top of the requestTrackingAuthorizationWithCompletionHandler method. You can use this wrapper to gather information about the user's authorization status.

Objective-C
[Adjust requestTrackingAuthorizationWithCompletionHandler:^(NSUInteger status) {
    switch (status) {
        case 0:
            // ATTrackingManagerAuthorizationStatusNotDetermined case
            break;
        case 1:
            // ATTrackingManagerAuthorizationStatusRestricted case
            break;
        case 2:
            // ATTrackingManagerAuthorizationStatusDenied case
            break;
        case 3:
            // ATTrackingManagerAuthorizationStatusAuthorized case
            break;
    }
}];

Return values

Retrieve the current tracking authorization status

As of iOS 14.5, users need to give explicit consent for you to capture a device's ID for Advertisers (IDFA). You can query the Adjust SDK for the consent status with the appTrackingAuthorizationStatus method.

- (int) appTrackingAuthorizationStatus
Objective-C
Swift
Javascript
int authorizationStatus = [Adjust appTrackingAuthorizationStatus];

Returns

Values

Get deep link attribution information from a URL

If you are using deep links, you can instruct the Adjust SDK to search the URL for attribution information. If the SDK finds valid information, it will send this information to the Adjust backend.

+ (void) appWillOpenUrl: (nonnull NSURL *) url
Objective-C
Swift
[Adjust appWillOpenUrl:url];

Parameters

Get current attribution data

After a user has installed your app, you can query the Adjust SDK for the device attribution information.

Note:
Attribution information is only available after the Adjust backend has tracked an install. The backend will return the information when it has received the install event.
+ (ADJAttribution *) attribution
Objective-C
Swift
Javascript
ADJAttribution *attribution = [Adjust attribution];

Returns

Convert a universal URL to a scheme URL

The Adjust SDK contains a helper method to convert universal links into deep links. To use this, pass your custom deep link scheme to the convertUniversalLink method.

+ (nullable NSURL *) convertUniversalLink: (nonnull NSURL *) url
                                   scheme: (nonnull NSString *) scheme
Objective-C
Swift
[Adjust convertUniversalLink:url scheme:@"adjustExample"];

Parameters

Returns

Change third-party sharing options

You can communicate a user's preference for third-party sharing. Call the following method with a third party sharing object. Initialize the object with the user's preference.

You can also:

  • Pass granular options with the user's preference to gather more detail for your analytics.
  • Pass the partner-specific user's preference for third party sharing.
(void) + trackThirdPartySharing
Objective-C
Swift
Javascript
// Disable third-party sharing for the user

ADJThirdPartySharing *adjustThirdPartySharing = [[ADJThirdPartySharing alloc] initWithIsEnabledNumberBool:@NO];
[Adjust trackThirdPartySharing:adjustThirdPartySharing];

// Enable third-party sharing for the user

ADJThirdPartySharing *adjustThirdPartySharing = [[ADJThirdPartySharing alloc] initWithIsEnabledNumberBool:@YES];
[Adjust trackThirdPartySharing:adjustThirdPartySharing];

// Gather granular details

ADJThirdPartySharing *adjustThirdPartySharing = [[ADJThirdPartySharing alloc] initWithIsEnabledNumberBool:nil];
[adjustThirdPartySharing addGranularOption:@"PartnerA" key:@"foo" value:@"bar"];
[Adjust trackThirdPartySharing:adjustThirdPartySharing];

// Partner-specific third-party sharing

ADJThirdPartySharing *adjustThirdPartySharing = [[ADJThirdPartySharing alloc] initWithIsEnabledNumberBool:nil];
[adjustThirdPartySharing addPartnerSharingSetting:@"PartnerA" key:@"install" value:@YES];
[adjustThirdPartySharing addPartnerSharingSetting:@"PartnerA" key:@"events" value:@YES];
[adjustThirdPartySharing addPartnerSharingSetting:@"PartnerA" key:@"sessions" value:@YES];
[Adjust trackThirdPartySharing:adjustThirdPartySharing];

Disable sharing of data to third parties

You can prevent sharing information with third-parties by calling the disableThirdPartySharing method. This is set to false by default.

+ (void) disableThirdPartySharing
Objective-C
Swift
Javascript
[Adjust disableThirdPartySharing];

Enable data privacy settings in the SDK

If you are using Adjust's data privacy settings, you need to toggle this in the Adjust SDK. Call the trackMeasurementConsent method to set this up.

+ (void) trackMeasurementConsent: (BOOL) enabled
Objective-C
Swift
Javascript
[Adjust trackMeasurementConsent:YES];

Enable user to request to be forgotten for GDPR

You can enable users to request the right to be forgotten. When you call this method, the Adjust SDK will communicate the request to the Adjust backend. The Adjust backend will erase the user's information.

- (void) gdprForgetMe
Objective-C
Swift
Javascript
[Adjust gdprForgetMe];

Gather a device's IDFA

You can retrieve a device's ID for Advertisers (IDFA) by calling on the idfa method.

+ (nullable NSString *) idfa
Objective-C
Swift
Javascript
NSString *idfa = [Adjust idfa];

Returns

Enable or disable the Adjust SDK

You can enable and disable tracking with the Adjust SDK using the setEnabled method.

Note:
The Adjust SDK is always enabled by default. You can check its status using the checkEnabled method.
+ (void) setEnabled: (BOOL) enabled
Objective-C
Swift
Javascript
[Adjust setEnabled:NO];

Check the Adjust SDK is enabled

You can check whether the Adjust SDK is enabled by calling on the isEnabled method.

+ (BOOL) isEnabled
Objective-C
Swift
Javascript
[Adjust isEnabled];

Check the version of the Adjust SDK

If you want to verify which version of the Adjust SDK a device is running, you can call on the sdkVersion method.

+ (NSString *) sdkVersion
Objective-C
Swift
[Adjust sdkVersion];

Returns

Set up a push token

If you are making use of push notifications for reattribution, you need to add your token to the Adjust SDK.

+ (void) setDeviceToken: (nonnull NSData *) deviceToken
Objective-C
Swift
Javascript
[Adjust setDeviceToken:deviceToken];

Parameters

Enable or disable offline mode

When a user's device goes offline, you can queue events by putting the SDK into offline mode. In this mode the Adjust SDK will store all events until it comes back online. When the Adjust SDK comes back online, it will attempt to send the events.

Important:
The offline mode setting is not remembered between app launches. The Adjust SDK will always start in online mode even if you toggled offline mode when the app was last open.
+ (void) setOfflineMode: (BOOL) enabled
Objective-C
Swift
Javascript
[Adjust setOfflineMode:YES]; // Enables offline mode
[Adjust setOfflineMode:NO]; // Disables offline mode

Track ad revenue from a specific source

The Adjust SDK supports receiving ad revenue information from certain network partners. You can pass information recorded by the network partner's SDK to the Adjust SDK as a JSON object.

Note:
This feature is only available for certain ad revenue sources. Check the values table for a list of supported sources.
+ (void) trackAdRevenue: (nonnull NSString *) source
                payload: (nonnull NSData *)   payload 
Objective-C
Swift
// initilise ADJAdRevenue instance with appropriate ad revenue source
ADJAdRevenue *adRevenue = [[ADJAdRevenue alloc] initWithSource:source];
// pass revenue and currency values
[adRevenue setRevenue:1.6 currency:@"USD"];
// pass optional parameters
[adRevenue setAdImpressionsCount:adImpressionsCount];
[adRevenue setAdRevenueUnit:adRevenueUnit];
[adRevenue setAdRevenuePlacement:adRevenuePlacement];
[adRevenue setAdRevenueNetwork:adRevenueNetwork];
// attach callback and/or partner parameter if needed
[adRevenue addCallbackParameter:key value:value];
[adRevenue addPartnerParameter:key value:value];

// track ad revenue
[Adjust trackAdRevenue:adRevenue];

Parameters

Values

Track an event

The Adjust SDK allows you to pass back event information to the Adjust backend. This can be seen when looking at raw data exports.

+ (void) trackEvent: (nullable ADJEvent *) event
Objective-C
Swift
ADJEvent *event = [ADJEvent eventWithEventToken:@"abc123"];
[Adjust trackEvent:event];

Parameters

Track a subscription

Warning:
Adjust no longer offers subscription recording for new customers. If you are already set up with subscription recording, reach out to your dedicated Technical Account Manager or support@adjust.com.

The Adjust SDK enables you to track information about in-app subscriptions events. You can do this by forming a subscription object and passing it to the SDK.

+ (void) trackSubscription: (nonnull ADJSubscription *) subscription
Objective-C
Swift
ADJSubscription *subscription = [[ADJSubscription alloc] initWithPrice:price
                                                              currency:currency
                                                         transactionId:transactionId
                                                            andReceipt:receipt];

[Adjust trackSubscription:subscription];

Parameters

Notify the SDK that the application has been paused

You can notify the Adjust SDK that the application has been paused by calling the trackSubsessionEnd method.

Note:
This method only needs to be called if system-level notifications cannot be used.
+ (void) trackSubsessionEnd
Objective-C
Swift
[Adjust trackSubsessionEnd];

Notify the SDK that the application has been resumed

You can notify the Adjust SDK that the application has been resumed by calling the trackSubsessionStart method.

Note:
This method only needs to be called if system-level notifications cannot be used.
Objective-C
Swift
[Adjust trackSubsessionStart];

Prompt the SDK to send initial payload

If you delay the start of the Adjust SDK, it will send information to the backend after the delay timer runs out. You can us this method to prompt the SDK to send packages before the delay time is up.

+ (void) sendFirstPackages
Objective-C
Swift
[Adjust sendFirstPackages];