コンテンツにスキップ

MMP向けのインプレッションレベルのユーザー収益API

このAPIは、パブリッシャー - サブスクライバーアーキテクチャを採用しています。 MAX SDKはMAXの広告収益イベントをブロードキャストし、MMPは max_revenue_events トピックをサブスクライブします。AppLovinでは、アプリの起動後、すぐにそのトピックにサブスクライブすることを推奨しています。 これにより、イベントを見逃すことはありません。 各ブロードキャストイベントには、以下のパラメーターが含まれます。

説明
ad_format広告の広告フォーマットBANNER, MREC, INTER, REWARDED
country_code収益の国コードUS(アメリカ合衆国の場合)
idサーバーの一意の内部ID。19017d954ffcded6c42772b09ec36699efe0bfc2
max_ad_unit_idMAX広告ユニットID。65d8d0195e50bda6
network_name広告を表示するネットワークの表示名。AppLovin
revenue収益額を表す倍精度浮動小数点数。0.002067201
third_party_ad_placement_id広告のプレースメントID(該当する場合)。ただし、入札広告にはプレースメントIDがない場合があります。inter_regular
user_segment広告を表示するユーザーのユーザーセグメント。experiment5

次の例は、SDKがブロードキャストするイベントをサブスクライブして処理する方法を示しています。

#import "ExampleViewController.h"
#import <AppLovinSDK/AppLovinSDK.h>
@interface ExampleViewController()<ALCSubscriber>
@end
@implementation ExampleViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[[ALCCommunicator defaultCommunicator] subscribe: self forTopic: @"max_revenue_events"];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear: animated];
// Unsubscribe when subscription is no longer needed
[[ALCCommunicator defaultCommunicator] unsubscribe: self forTopic: @"max_revenue_events"];
}
#pragma mark - AppLovin Communicator Subscriber Protocol
- (void)didReceiveMessage:(ALCMessage *)message
{
// If you are subscribed to multiple topics, check for the desired one
if ( [@"max_revenue_events" isEqualToString: message.topic] )
{
double revenue = [message.data[@"revenue"] doubleValue];
// MAX revenue event messages will also contain the same info as MAX ad event messages, but without the "type"
NSString *countryCode = message.data[@"country_code"]; // "US" for the United States, etc - Note: Do not confuse this with currency code which is "USD"
NSString *networkName = message.data[@"network_name"]; // Display name of the network which showed the ad
NSString *adUnitIdentifier = message.data[@"max_ad_unit_id"]; // The MAX Ad Unit ID
NSString *thirdPartyAdPlacementIdentifier = message.data[@"third_party_ad_placement_id"]; // The ad's placement id, if any (bidding may not have one)
NSString *adFormat = message.data[@"ad_format"]; // The ad format of the ad (e.g. "BANNER", "MREC", "INTER", "REWARDED")
}
}
- (NSString *)communicatorIdentifier;
{
return @"«your_company_name_in_snake_case»";
}
@end