adjust-icon

Unity SDK integration

If you want to measure ad revenue with the Unity SDK, you can use the SDK-to-SDK integration to pass this information to Adjust’s servers.

Before you begin

To use this feature, you first need to download and set up the Adjust iOS SDK for your app.

For more information, see the Unity Mediation API and impression events documentation.

Example

@interface ViewController()
@property(nonatomic, strong) UMSImpressionListenerWithBlocks * listener;
@end
@implementation ViewController
- (void) viewDidLoad {
[super viewDidLoad];
self.listener = [[UMSImpressionListenerWithBlocks alloc] init];
self.listener.onImpressionBlock = ^ (NSString *adUnitId, UMSImpressionData *impressionData) {
if (impressionData) {
NSLog(@ "impressionData: %@", [impressionData getJsonRepresentation]);
// send impression data to Adjust
ADJAdRevenue *adRevenue = [[ADJAdRevenue alloc]
initWithSource:@"unity_sdk"];
adjustAdRevenue.setRevenue([impressionData.revenue doubleValue], impressionData.currency);
// optional fields
adjustAdRevenue.setAdRevenueNetwork(impressionData.adSourceName);
adjustAdRevenue.setAdRevenueUnit(impressionData.adUnitId);
adjustAdRevenue.setAdRevenuePlacement(impressionData.adSourceInstance);
// Send Adjust ad revenue
Adjust.trackAdRevenue(adjustAdRevenue);
} else {
NSLog(@ "Data does not exist due to not enabling User-Level Reporting");
}
};
[UMSImpressionEventPublisher subscribe: self.listener];
}
@end