adjust-icon

Set up SKAdNetwork and conversion values

StoreKit Ad Network (SKAdNetwork) is Apple’s attribution framework for app install and reinstall attribution. The SKAdNetwork workflow goes like this:

  1. Apple gathers attribution information and notifies the relevant ad network.
  2. The network sends a postback with this information to Adjust.
  3. Adjust displays SKAdNetwork data in Datascape.

Disable SKAdNetwork communication

Property declaration
bool? isSkanAttributionEnabled;

The Adjust SDK communicates with SKAdNetwork by default. The SDK registers for SKAdNetwork attribution upon initialization.

You can control this behavior by setting the isSkanAttributionEnabled property of your AdjustConfig instance to a bool value.

AdjustConfig adjustConfig = new AdjustConfig('{YourAppToken}', AdjustEnvironment.sandbox, true);
//...
adjustConfig.isSkanAttributionEnabled = false;
//...
Adjust.initSdk(adjustConfig);

Update conversion values

Method signature
static Future<String?> updateSkanConversionValue(int conversionValue, String coarseValue, bool lockWindow)

Conversion values are a mechanism used to measure user behavior in SKAdNetwork. You can map 64 conditions to values from 0 through 63 and send this integer value to SKAdNetwork on user install. This gives you insight into how your users interact with your app in the first few days.

If you manage your conversion values with Adjust, the servers update this value in the SDK. You can also update this value by using the updateSkanConversionValue method. It accepts the following arguments:

ArgumentData typeDescription
conversionValueintYour conversion value. Must be between 0 and 63.
coarseValueString (SKAdNetwork.CoarseConversionValue)The coarse conversion value. This value is used if your app doesn’t have sufficient installs to reach the privacy threshold.
  • 'low' (for SKAdNetworkCoarseConversionValueLow)
  • 'medium' (for SKAdNetworkCoarseConversionValueMedium)
  • 'high' (for SKAdNetworkCoarseConversionValueHigh)
lockWindowbool?Whether to send the postback before the conversion window ends.
Use true to tell the system to send the postback without waiting for the end of the conversion window. Defaults to false.
Adjust.updateSkanConversionValue(6, 'coarse-value', true).then((error) {
// error is present in case it happens
});

Listen for changes to conversion values

Property declaration
typedef void SkanUpdatedCallback(Map<String, String> skanUpdateData);
SkanUpdatedCallback? skanUpdatedCallback;

If you use Adjust to manage conversion values, the Adjust’s servers send conversion value updates to the SDK. You can set up a delegate function to listen for these changes using the skanUpdatedCallback method. Pass your function as an argument.

AdjustConfig adjustConfig = new AdjustConfig(yourAppToken, environment);
adjustConfig.skanUpdatedCallback = (Map<String, String> data) {
print(Skan Callback: $data');
};
print('[Adjust]: Received conversion value update: ' + conversionValue!.toString());
};
Adjust.initSdk(adjustConfig);

Example

This example shows how to log the following when the conversion value updates:

  • A message confirming the conversion value update
  • The new conversion value
main.dart
import 'package:adjust_sdk/adjust.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
initPlatformState() async {
AdjustConfig config =
new AdjustConfig('{YourAppToken}', AdjustEnvironment.sandbox);
config.logLevel = AdjustLogLevel.verbose;
config.conversionValueUpdatedCallback = (num? conversionValue) {
print('[Adjust]: Received conversion value update: ' +
conversionValue!.toString());
};
Adjust.initSdk(config);
}

SKAdNetwork 4.0 callbacks

SKAdNetwork 4.0 postbacks contain some additional information to give advertisers more insight into their users. When Adjust’s servers update conversion values, this additional information is sent in a payload. You can access this information with the skanUpdatedCallback callback method.

ArgumentsData typeDescription
conversionValueStringThe conversion value sent by Adjust’s servers
coarseValueStringThe coarse conversion value. This value is used if your app doesn’t have sufficient installs to reach the privacy threshold.
  • none
  • low
  • medium
  • high

Apple sends none whenever none of the conditions that are set for low, medium, and high were met.
lockWindowboolWhether to send the postback before the conversion window ends. 1 indicates the postback will be sent before the conversion window ends.
Defaults to 0 in SKAdNetwork 4.0 postbacks and nil in older SKAdNetwork versions

Example

This example shows how to log the the fine conversion value, the coarse conversion value, and whether the SKAdNetwork postback is set to send before the conversion window ends.

import 'package:adjust_sdk/adjust.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
initPlatformState() async {
AdjustConfig config =
new AdjustConfig('{YourAppToken}', AdjustEnvironment.sandbox);
config.logLevel = AdjustLogLevel.verbose;
config.skanUpdatedCallback = (Map<String, String> skanUpdateData) {
// process skanUpdateData map
// example: {conversion_value: 0, lock_window: false, coarse_value: low}
print('[Adjust]: Conversion value updated. Callback received');
print('[Adjust]: Conversion value: ' + conversionValue!.toString());
print('[Adjust]: Coarse conversion value: ' + coarseValue!);
print('[Adjust]: Will send before conversion value window ends: ' lockWindow!.toString());
};
Adjust.initSdk(config);
}

Set up direct install postbacks

You can configure your app to send a copy of winning SKAdNetwork callbacks to Adjust. This enables you to use SKAdNetwork information in your analytics.

To set up direct install postbacks, you need to add the Adjust callback URL to your Info.plist file:

  1. Select Info.plist in the Project navigator in Xcode.
  2. Select the Add button beside a key in the property list editor and press Return.
  3. Enter NSAdvertisingAttributionReportEndpoint as the key name.
  4. Set the Type to String in the pop up menu.
  5. Enter the address https://adjust-skadnetwork.com.