adjust-icon

Record ad revenue information

You can record ad revenue for supported network partners using the Adjust SDK.

Instantiate an AdjustAdRevenue object

Method signature
AdjustAdRevenue(this._source) {
_callbackParameters = new Map<String, String>();
_partnerParameters = new Map<String, String>();
}

To send ad revenue information with the Adjust SDK, you need to instantiate an AdjustAdRevenue object. This object contains variables that are sent to Adjust when ad revenue is recorded in your app.

To instantiate an ad revenue object, create a new AdjustAdRevenue instance and pass the following parameters:

  • source (String): The source of the ad revenue. See the table below for available sources
ParameterSource
AdjustConfig.AdRevenueSourceAppLovinMAXAppLovin MAX
AdjustConfig.AdRevenueSourceMopubMopub
AdjustConfig.AdRevenueSourceAdMobAdMob
AdjustConfig.AdRevenueSourceIronSourceironSource
AdjustConfig.AdRevenueSourceAdmostAdMost
AdjustConfig.AdRevenueSourceUnityUnity
AdjustConfig.AdRevenueSourceHeliumChartboostHelium Chartboost
AdjustConfig.AdRevenueSourceTradPlusTradPlus
AdjustConfig.AdRevenueSourceTopOnTopOn
AdjustConfig.AdRevenueSourcePublisherGeneric source
AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue('source');
Adjust.trackAdRevenueNew(adjustAdRevenue);

Send ad revenue

Method signature
static void trackAdRevenue(String source, String payload) {
_channel
.invokeMethod('trackAdRevenue', {'source': source, 'payload': payload});
}

To send ad revenue to Adjust, call the trackAdRevenue method with your ad revenue instance as an argument.

AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue('source');
Adjust.trackAdRevenueNew(adjustAdRevenue);

Record ad revenue amount

Method signature
void setRevenue(num revenue, String currency) {
_revenue = revenue;
_currency = currency;
}

To send the ad revenue amount, call the setRevenue method and pass the following arguments:

  • revenue (num): The amount of revenue
  • currency (String): The 3 character ISO 4217 code of your reporting currency
AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue('source');
adjustAdRevenue.setRevenue(1.00, 'EUR');
Adjust.trackAdRevenueNew(adjustAdRevenue);

Record ad campaign details

The AdjustAdRevenue class contains properties you can use to report on your ad campaigns.

Ad impressions

Property declaration
num? adImpressionsCount

To send the number of recorded ad impressions, assign a num value to the adImpressionsCount property of your ad revenue instance.

AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue('source');
adjustAdRevenue.adImpressionsCount = 10;
Adjust.trackAdRevenueNew(adjustAdRevenue);

Ad revenue network

Property declaration
String? adRevenueNetwork

To send the ad revenue network, assign the network name as a String value to the adRevenueNetwork property of your ad revenue instance.

AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue('source');
adjustAdRevenue.adRevenueNetwork = 'network1';
Adjust.trackAdRevenueNew(adjustAdRevenue);

Ad revenue unit

Property declaration
String? adRevenueUnit

To send the ad revenue unit, assign the unit as a String value to the adRevenueUnit property of your ad revenue instance.

AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue('source');
adjustAdRevenue.adRevenueUnit = 'unit1';
Adjust.trackAdRevenueNew(adjustAdRevenue);

Ad revenue placement

Property declaration
String? adRevenuePlacement

To send the ad revenue placement, assign the placement as a String value to the adRevenuePlacement property of your ad revenue instance.

AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue('source');
adjustAdRevenue.adRevenuePlacement = 'banner';
Adjust.trackAdRevenueNew(adjustAdRevenue);

Add callback parameters

Method signature
void addCallbackParameter(String key, String value) {
_callbackParameters![key] = value;
}

If you register a callback URL in the Adjust dashboard, the SDK sends a GET request to your callback URL when it records an event.

You can configure callback parameters to your servers. Once you configure parameters on an event, the SDK appends them to your callback URL. You can use this information to analyze your users’ in-app behavior with your BI system.

Add callback parameters to your event by calling the addCallbackParameter method with String key-value arguments. You can add multiple parameters by calling this method multiple times.

The Adjust SDK measures the event and sends a request to your URL with the callback parameters. For example, if you register the URL https://www.mydomain.com/callback, your callback looks like this:

https://www.mydomain.com/callback?key=value&foo=bar

If you are using CSV uploads, make sure to add the parameters to your CSV definition.

Adjust supports many placeholders which you can use to pass information from the SDK to your URL. For example, the {idfa} placeholder for iOS and the {gps_adid} placeholder for Android. The {publisher_parameter} placeholder presents all callback parameters in a single string.

AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue('source');
adjustAdRevenue.addCallbackParameter('key', 'value')
Adjust.trackAdRevenueNew(adjustAdRevenue);

Add partner parameters

Method signature
void addPartnerParameter(String key, String value) {
_partnerParameters![key] = value;
}

You can send extra information to your network partners by adding partner parameters.

Adjust sends partner parameters to external partners you have set up. This information is useful for more granular analysis and retargeting purposes. Adjust’s servers forward these parameters once you have set them up and enabled them for a partner.

Add partner parameters to your event by calling the addPartnerParameter method with String key-value arguments. You can add multiple parameters by calling this method multiple times.

AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue('source');
adjustAdRevenue.addPartnerParameter('key', 'value');
Adjust.trackAdRevenueNew(adjustAdRevenue);

Example

This example shows how to set up and record an ad revenue object with the following properties:

  • AppLovin MAX as the revenue source
  • 1 Euro as the revenue amount
  • 10 ad impressions
  • 'network1' as the ad revenue network
  • 'unit1' as the ad revenue unit
  • 'banner' as the ad revenue placement
  • A callback parameter: 'key1' = 'value1'
  • A partner parameter: 'key2' = 'value2'
AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue(AdjustConfig.AdRevenueSourceAppLovinMAX);
adjustAdRevenue.setRevenue(1.00, 'EUR');
adjustAdRevenue.adImpressionsCount = 10;
adjustAdRevenue.adRevenueNetwork = 'network1';
adjustAdRevenue.adRevenueUnit = 'unit1';
adjustAdRevenue.adRevenuePlacement = 'banner';
adjustAdRevenue.addCallbackParameter('key1', 'value1');
adjustAdRevenue.addPartnerParameter('key2', 'value2');
Adjust.trackAdRevenueNew(adjustAdRevenue);