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.

Functions

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.

static void com.adjust.sdk.Adjust.addSessionCallbackParameter ( String key,
                                                                String value 
                                                              )
Java
Javascript
Adjust.addSessionCallbackParameter("foo", "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.

static void com.adjust.sdk.Adjust.removeSessionCallbackParameter ( String key )	
Java
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.

static void com.adjust.sdk.Adjust.resetSessionCallbackParameters()	
Java
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.

static void com.adjust.sdk.Adjust.addSessionPartnerParameter ( String key,
                                                               String value
                                                             )
Java
Javascript
Adjust.addSessionPartnerParameter("foo", "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.

static void com.adjust.sdk.Adjust.removeSessionPartnerParameter ( String key )	
Java
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.

static void com.adjust.sdk.Adjust.resetSessionPartnerParameters ()
Java
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.
static String com.adjust.sdk.Adjust.getAdid ()
Java
Javascript
String adid = Adjust.getAdid();

Returns

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.

static void com.adjust.sdk.Adjust.appWillOpenUrl ( Uri     url,
                                                   Context context 
                                                 )
Java
Javascript
Adjust.appWillOpenUrl(url, getApplicationContext());

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.
static AdjustAttribution com.adjust.sdk.Adjust.getAttribution ()
Java
Javascript
AdjustAttribution attribution = Adjust.getAttribution();

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.

Java
Javascript
// Disable third-party sharing for the user

AdjustThirdPartySharing adjustThirdPartySharing = new AdjustThirdPartySharing(false);
Adjust.trackThirdPartySharing(adjustThirdPartySharing);

// Enable third-party sharing for the user

AdjustThirdPartySharing adjustThirdPartySharing = new AdjustThirdPartySharing(true);
Adjust.trackThirdPartySharing(adjustThirdPartySharing);

// Gather granular details

AdjustThirdPartySharing adjustThirdPartySharing = new AdjustThirdPartySharing(null);
adjustThirdPartySharing.addGranularOption("PartnerA", "foo", "bar");
Adjust.trackThirdPartySharing(adjustThirdPartySharing);

// Partner-specific third-party sharing

AdjustThirdPartySharing adjustThirdPartySharing = new AdjustThirdPartySharing(null);
adjustThirdPartySharing.addPartnerSharingSetting("PartnerA", "install", true);
adjustThirdPartySharing.addPartnerSharingSetting("PartnerA", "events", true);
adjustThirdPartySharing.addPartnerSharingSetting("PartnerA", "sessions", true);
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.

static void com.adjust.sdk.Adjust.disableThirdPartySharing (final Context context)
Java
Javascript
Adjust.disableThirdPartySharing(getApplicationContext());

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.

static void com.adjust.sdk.Adjust.trackMeasurementConsent (final boolean consentMeasurement)
Java
Javascript
Adjust.trackMeasurementConsent(true);

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.

static void com.adjust.sdk.Adjust.gdprForgetMe (final Context context)	
Java
Javascript
Adjust.gdprForgetMe(context);

Gather a device's Google Play Advertising ID

If you are targeting the Google Play Store, you can use the Adjust SDK to retrieve a device's advertising ID. This is sometimes useful for performing analysis.

static void com.adjust.sdk.Adjust.getGoogleAdId (Context         context,
                                                 OnDeviceIdsRead onDeviceIdRead
                                                )
Java
Javascript
Adjust.getGoogleAdId(this, new OnDeviceIdsRead() {
    @Override
    public void onGoogleAdIdRead(String googleAdId) {}
});

Gather a device's Amazon Advertising ID

If you are targeting the Amazon App Store, you can use the Adjust SDK to retrieve a device's advertising ID. This is sometimes useful for performing analysis.

static String com.adjust.sdk.Adjust.getAmazonAdId (final Context context)	
Java
Javascript
String amazonAdId = Adjust.getAmazonAdId(context);

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.
static void com.adjust.sdk.Adjust.setEnabled (boolean enabled)		
Java
Javascript
Adjust.setEnabled(false);

Check the Adjust SDK is enabled

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

static boolean com.adjust.sdk.Adjust.isEnabled ()	
Java
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.

static String com.adjust.sdk.Adjust.getSdkVersion ()	
Java
Javascript
Adjust.getSdkVersion();

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.

static void com.adjust.sdk.Adjust.setPushToken (final String  token,
                                                final Context context
                                               )
Java
Javascript
// Send the token with context (recommended)
Adjust.setPushToken(pushNotificationsToken, context);

// Send the token without context (not recommended)
Adjust.setPushToken(pushNotificationsToken);

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.
static void com.adjust.sdk.Adjust.setOfflineMode (boolean enabled)	
Java
Javascript
Adjust.setOfflineMode(true); // Enables offline mode
Adjust.setOfflineMode(false); // 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.
static void com.adjust.sdk.Adjust.trackAdRevenue (final AdjustAdRevenue adjustAdRevenue)
Java
AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue(AdjustConfig.AD_REVENUE_APPLOVIN_MAX);
adjustAdRevenue.setRevenue(1.00, "EUR");
adjustAdRevenue.setAdImpressionsCount(10);
adjustAdRevenue.setAdRevenueNetwork("network1");
adjustAdRevenue.setAdRevenueUnit("unit1");
adjustAdRevenue.setAdRevenuePlacement("banner");
adjustAdRevenue.addCallbackParameter("key1", "value1");
adjustAdRevenue.addPartnerParameter("key2", "value2");
Adjust.trackAdRevenue(adjustAdRevenue);

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.

static void com.adjust.sdk.Adjust.trackEvent (AdjustEvent event)
Java
Javascript
AdjustEvent adjustEvent = new AdjustEvent("abc123");
Adjust.trackEvent(adjustEvent);

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.

static void com.adjust.sdk.Adjust.trackPlayStoreSubscription (final AdjustPlayStoreSubscription subscription)
Java
AdjustPlayStoreSubscription subscription = new AdjustPlayStoreSubscription(
    price,
    currency,
    sku,
    orderId,
    signature,
    purchaseToken);
subscription.setPurchaseTime(purchaseTime);

Adjust.trackPlayStoreSubscription(subscription);

Parameters

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.

static void com.adjust.sdk.Adjust.sendFirstPackages ()
Java
Javascript
Adjust.sendFirstPackages();