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 Unity SDK for your app.

Requirements

  • Adjust Unity SDK v4.29.6 or later

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

Example

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(AdjustConfig.AdjustAdRevenueSourceUnity);
adjustAdRevenue.setRevenue(e.ImpressionData.PublisherRevenuePerImpression, e.ImpressionData.Currency);
// optional fields
adjustAdRevenue.setAdRevenueNetwork(e.ImpressionData.AdSourceName);
adjustAdRevenue.setAdRevenueUnit(e.ImpressionData.AdUnitId);
adjustAdRevenue.setAdRevenuePlacement(e.ImpressionData.AdSourceInstance);
// Send Adjust ad revenue
Adjust.trackAdRevenue(adjustAdRevenue);
}
}