adjust-icon

Unity SDK 集成

如果您想使用 Unity SDK 监测广告收入,可以借助 SDK 到 SDK 集成,将数据发送到 Adjust 服务器。

操作前须知

要使用该功能,请先为您的应用下载并设置对应的 Adjust 安卓 SDK。

要了解更多信息,请查看 Unity Mediation API展示事件文档。

示例

// implement an impression listener
final IImpressionListener impressionListener = new IImpressionListener() {
@Override
public void onImpression(@NonNull String adUnitId, @Nullable ImpressionData impressionData) {
// send impression data to Adjust
AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue("unity_sdk");
adjustAdRevenue.setRevenue(impressionData.getPublisherRevenuePerImpression(), impressionData.getCurrency());
// optional fields
adjustAdRevenue.setAdRevenueNetwork(impressionData.getAdSourceName());
adjustAdRevenue.setAdRevenueUnit(impressionData.getAdUnitId());
adjustAdRevenue.setAdRevenuePlacement(impressionData.getAdSourceInstance());
// Send Adjust ad revenue
Adjust.trackAdRevenue(adjustAdRevenue);
}
};
// subscribe the impression listener to the impression event publisher
ImpressionEventPublisher.subscribe(impressionListener);
// unsubscribe the impression listener from the impression event publisher
ImpressionEventPublisher.unsubscribe(impressionListener);