adjust-icon

Unity SDK 集成

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

操作前须知

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

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

示例

static void OnImpression(object sender, ImpressionEventArgs e)
{
var impressionData = e.ImpressionData != null ? JsonUtility.ToJson(e.ImpressionData, true) : "null";
Debug.Log($"Impression event from ad unit id {e.AdUnitId} : {impressionData}");
// send impression data to Adjust
if (e.ImpressionData != null)
{
AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue("unity_sdk");
adjustAdRevenue.SetRevenue(e.ImpressionData.PublisherRevenuePerImpression, e.ImpressionData.Currency);
// optional fields
adjustAdRevenue.AdRevenueNetwork = e.ImpressionData.AdSourceName;
adjustAdRevenue.AdRevenueUnit = e.ImpressionData.AdUnitId;
adjustAdRevenue.AdRevenuePlacement = e.ImpressionData.AdSourceInstance;
// Send Adjust ad revenue
Adjust.TrackAdRevenue(adjustAdRevenue);
}
}