You can record ad revenue for supported network partners using the Adjust SDK.
Instantiate an AdjustAdRevenue object
constructor(source: 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
Parameter | Source |
---|---|
AdjustConfig.AdRevenueSourceAppLovinMAX | AppLovin MAX |
AdjustConfig.AdRevenueSourceMopub | Mopub |
AdjustConfig.AdRevenueSourceAdMob | AdMob |
AdjustConfig.AdRevenueSourceIronSource | ironSource |
AdjustConfig.AdRevenueSourceAdmost | AdMost |
AdjustConfig.AdRevenueSourceUnity | Unity |
AdjustConfig.AdRevenueSourceHeliumChartboost | Helium Chartboost |
AdjustConfig.AdRevenueSourcePublisher | Generic source |
var adjustAdRevenue = new AdjustAdRevenue("source");
Adjust.trackAdRevenue(adjustAdRevenue);
Send ad revenue
trackAdRevenue: ((source: string, payload: string) => void) & ((source: AdjustAdRevenue) => void)
To send ad revenue to Adjust, call the trackAdRevenue
method with your ad revenue instance as an argument.
var adjustAdRevenue = new AdjustAdRevenue("source");
Adjust.trackAdRevenue(adjustAdRevenue);
Record ad revenue amount
public setRevenue(revenue: number, currency: string): void
To send the ad revenue amount, call the setRevenue
method and pass the following arguments:
revenue
(number
): The amount of revenuecurrency
(string
): The 3 character ISO 4217 code of your reporting currency
var adjustAdRevenue = new AdjustAdRevenue("source");
adjustAdRevenue.setRevenue(1.0, "EUR");
Adjust.trackAdRevenue(adjustAdRevenue);
Record ad campaign details
The AdjustAdRevenue
class contains properties you can use to report on your ad campaigns.
Ad impressions
public setAdImpressionsCount(adImpressionsCount: number): void
To send the number of recorded ad impressions, call the setAdImpressionsCount
method and pass the following arguments:
adImpressionsCount
(number
): The number of ad impressions.
var adjustAdRevenue = new AdjustAdRevenue("source");
adjustAdRevenue.setAdImpressionsCount(10);
Adjust.trackAdRevenue(adjustAdRevenue);
Ad revenue network
public setAdRevenueNetwork(adRevenueNetwork: string): void
To send the ad revenue network, call the setAdRevenueNetwork
method and pass the following arguments:
adRevenueNetwork
(string
): The network name.
var adjustAdRevenue = new AdjustAdRevenue("source");
adjustAdRevenue.setAdRevenueNetwork("network1");
Adjust.trackAdRevenue(adjustAdRevenue);
Ad revenue unit
public setAdRevenueUnit(adRevenueUnit: string): void
To send the ad revenue unit, call the setAdRevenueUnit
method and pass the following arguments:
adRevenueUnit
(string
): The ad unit.
var adjustAdRevenue = new AdjustAdRevenue("source");
adjustAdRevenue.setAdRevenueUnit("unit1");
Adjust.trackAdRevenue(adjustAdRevenue);
Ad revenue placement
public setAdRevenuePlacement(adRevenuePlacement: string): void
Record the placement of your ad by passing a string
value to the setAdRevenuePlacement
method.
var adjustAdRevenue = new AdjustAdRevenue("source");
adjustAdRevenue.setAdRevenuePlacement("banner");
Adjust.trackAdRevenue(adjustAdRevenue);
Add callback parameters
public addCallbackParameter(key: string, value: string): void
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.
var adjustAdRevenue = new AdjustAdRevenue("source");
adjustAdRevenue.addCallbackParameter("key", "value");
Adjust.trackAdRevenue(adjustAdRevenue);
Add partner parameters
public addPartnerParameter(key: string, value: string): void
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.
var adjustAdRevenue = new AdjustAdRevenue("source");
adjustAdRevenue.addPartnerParameter("key", "value");
Adjust.trackAdRevenue(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"
var adjustAdRevenue = new AdjustAdRevenue( AdjustConfig.AdRevenueSourceAppLovinMAX,);adjustAdRevenue.setRevenue(1.0, "EUR");adjustAdRevenue.setAdImpressionsCount(10);adjustAdRevenue.setAdRevenueNetwork("network1");adjustAdRevenue.setAdRevenueUnit("unit1");adjustAdRevenue.setAdRevenuePlacement("banner");adjustAdRevenue.addCallbackParameter("key1", "value1");adjustAdRevenue.addPartnerParameter("key2", "value2");Adjust.trackAdRevenue(adjustAdRevenue);