Skip to content

Commit 5c01bc6

Browse files
authored
Merge pull request #600 from adjust/docs-sdk2sdk-unity-helium
SDK to SDK docs for Unity and Helium Chartboost
2 parents b1feb89 + 26a4091 commit 5c01bc6

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Track Helium Chartboost ad revenue with Adjust SDK
2+
3+
[Adjust iOS SDK README][ios-readme]
4+
5+
Minimum SDK version required for this feature:
6+
7+
- **Adjust SDK v4.29.7**
8+
9+
If you want to track your ad revenue with the Helium SDK, you can use our SDK-to-SDK integration to pass this information to the Adjust backend. To do this, you will need to construct an Adjust ad revenue object containing the information you wish to record, then pass the object to the `trackAdRevenue` method.
10+
11+
> Note: If you have any questions about ad revenue tracking with Helium Chartboost, please contact your dedicated account manager or send an email to [support@adjust.com](mailto:support@adjust.com).
12+
13+
### Example
14+
15+
```objc
16+
[NSNotificationCenter.defaultCenter addObserverForName:kHeliumDidReceiveILRDNotification
17+
object:nil
18+
queue:nil
19+
usingBlock:^(NSNotification * _Nonnull notification) {
20+
// extract the ILRD payload
21+
HeliumImpressionData *ilrd = (HeliumImpressionData *)notification.object;
22+
NSDictionary *json = ilrd.jsonData;
23+
// mandatory fields
24+
NSNumber *ad_revenue = [json objectForKey:@"ad_revenue"];
25+
NSString *currency_type = [json objectForKey:@"currency_type"];
26+
ADJAdRevenue *adjustAdRevenue = [[ADJAdRevenue alloc] initWithSource:ADJAdRevenueSourceHeliumChartboost];
27+
[adjustAdRevenue setRevenue:ad_revenue currency:currency_type];
28+
// optional fields
29+
NSString *network_name = [json objectForKey:@"network_name"]; // Helium demand network name
30+
NSString *placement_name = [json objectForKey:@"placement_name"]; // Helium placement name
31+
NSString *line_item_name = [json objectForKey:@"line_item_name"]; // Helium line item name
32+
[adjustAdRevenue setAdRevenueNetwork:network_name];
33+
[adjustAdRevenue setAdRevenueUnit:placement_name];
34+
[adjustAdRevenue setAdRevenuePlacement:line_item_name];
35+
// track Adjust ad revenue
36+
[Adjust trackAdRevenue:adjustAdRevenue];
37+
}
38+
```
39+
40+
[ios-readme]: ../../../README.md

doc/english/sdk-to-sdk/unity.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Track Unity ad revenue with Adjust SDK
2+
3+
[Adjust iOS SDK README][ios-readme]
4+
5+
Minimum SDK version required for this feature:
6+
7+
- **Adjust SDK v4.29.7**
8+
9+
If you want to track your ad revenue with the Unity SDK, you can use our SDK-to-SDK integration to pass this information to the Adjust backend. To do this, you will need to construct an Adjust ad revenue object containing the information you wish to record, then pass the object to the `trackAdRevenue` method.
10+
11+
> Note: If you have any questions about ad revenue tracking with Unity, please contact your dedicated account manager or send an email to [support@adjust.com](mailto:support@adjust.com).
12+
13+
For more information, see the Unity Mediation [API documentation](https://docs.unity.com/mediation/APIReferenceIOS.html) and [impression event documentation](https://docs.unity.com/mediation/SDKIntegrationIOSImpressionEvents.html).
14+
15+
### Example
16+
17+
```objc
18+
@interface ViewController()
19+
20+
@property(nonatomic, strong) UMSImpressionListenerWithBlocks * listener;
21+
22+
@end
23+
24+
@implementation ViewController
25+
26+
- (void) viewDidLoad {
27+
[super viewDidLoad];
28+
29+
self.listener = [[UMSImpressionListenerWithBlocks alloc] init];
30+
self.listener.onImpressionBlock = ^ (NSString *adUnitId, UMSImpressionData *impressionData) {
31+
if (impressionData) {
32+
NSLog(@ "impressionData: %@", [impressionData getJsonRepresentation]);
33+
// send impression data to Adjust
34+
ADJAdRevenue *adjustAdRevenue = [[ADJAdRevenue alloc] initWithSource:ADJAdRevenueSourceUnity];
35+
adjustAdRevenue.setRevenue([impressionData.revenue doubleValue], impressionData.currency);
36+
// optional fields
37+
adjustAdRevenue.setAdRevenueNetwork(impressionData.adSourceName);
38+
adjustAdRevenue.setAdRevenueUnit(impressionData.adUnitId);
39+
adjustAdRevenue.setAdRevenuePlacement(impressionData.adSourceInstance);
40+
// track Adjust ad revenue
41+
Adjust.trackAdRevenue(adjustAdRevenue);
42+
} else {
43+
NSLog(@ "Data does not exist due to not enabling User-Level Reporting");
44+
}
45+
};
46+
[UMSImpressionEventPublisher subscribe: self.listener];
47+
}
48+
49+
@end
50+
```
51+
52+
[ios-readme]: ../../../README.md

0 commit comments

Comments
 (0)