Mintegral has introduced a new Unity package to support Mintegral's Unity ROAS functionality.
This document outlines how to integrate the Mintegral ROAS Unity plugin into your project. Follow the steps below to ensure a successful integration.
Download the latest mintegral-roas-unity-plugin package here
Follow these steps to import the downloaded plugin:
Once imported, you should see an option named Mintegral in the Unity menu bar.
Ensure that your Unity environment is set to either iOS or Android.
Confirm the mediation platform you intend to integrate, such as AdMob, IronSource, or MAX.
Click on the Mintegral menu.
Choose iOS Ad Mediation or Android Ad Mediation, then select the platform you want to integrate, such as AdMob, IronSource, or MAX.
*Note: You need to click once for each environment (iOS or Android), but only one click is necessary.*
Wait for Unity to finish loading.
The plugin will add a macro definition to the Script Define Symbols in both the iOS and Android environments. This macro definition will not affect existing macro definitions.
If Mintegral ads are already configured on the backend, ignore this step. If not, manually initialize the Mintegral SDK when the application starts.
private const string mtgAppId = "";
private const string mtgAppKey = "";
MBridgeSDKManager.initialize(mtgAppId, mtgAppKey);
string adjustAdid = Adjust.getAdid();
string appsFlyerId = AppsFlyer.getAppsFlyerId();
Using the OnAdPaid Callback
// Example using a rewarded ad
private void RegisterEventHandlers_Reward(RewardedAd ad)
{
// Raised when the ad is estimated to have earned money.
ad.OnAdPaid += (AdValue adValue) =>
{
/*
ATTRIBUTION_PLATFORM_APPSFLYER = "AppsFlyer";
ATTRIBUTION_PLATFORM_ADJUST = "Adjust";
ATTRIBUTION_PLATFORM_TENJIN = "Tenjin";
ATTRIBUTION_PLATFORM_SINGULAR = "Singular";
ATTRIBUTION_PLATFORM_KOCHAVA = "Kochava";
ATTRIBUTION_PLATFORM_BRANCH = "Branch";
ATTRIBUTION_PLATFORM_REYUN = "Reyun";
ATTRIBUTION_PLATFORM_SOLAR_ENGINE = "SolarEngine";
...
...
*/
// Replace with your attribution platform name, for example, "Adjust"
string attributionPlatformName = MBridgeRevenueParamsEntity.ATTRIBUTION_PLATFORM_ADJUST;
// Replace "userid" with your attribution platform UID
MBridgeRevenueParamsEntity mBridgeRevenueParamsEntity = new MBridgeRevenueParamsEntity(attributionPlatformName, userid);
mBridgeRevenueParamsEntity.SetAdmobAdUnitid(admobAdUnitId);
// Replace with your current ad type, options include: Rewarded, Banner, Interstitial, Native, AppOpen.
mBridgeRevenueParamsEntity.SetAdmobAdType(admobAdType.Rewarded);
// adValue: a instance of AdValue
mBridgeRevenueParamsEntity.SetAdmobAdValue(adValue);
mBridgeRevenueParamsEntity.SetAdmobResponseInfo(ad.GetResponseInfo());
MBridgeRevenueManager.Track(mBridgeRevenueParamsEntity);
};
}
Using the onImpressionDataReadyEvent Callback
IronSourceEvents.onImpressionDataReadyEvent += ImpressionDataReadyEvent;
void ImpressionDataReadyEvent(IronSourceImpressionData impressionData)
{
/*
ATTRIBUTION_PLATFORM_APPSFLYER = "AppsFlyer";
ATTRIBUTION_PLATFORM_ADJUST = "Adjust";
ATTRIBUTION_PLATFORM_TENJIN = "Tenjin";
ATTRIBUTION_PLATFORM_SINGULAR = "Singular";
ATTRIBUTION_PLATFORM_KOCHAVA = "Kochava";
ATTRIBUTION_PLATFORM_BRANCH = "Branch";
ATTRIBUTION_PLATFORM_REYUN = "Reyun";
ATTRIBUTION_PLATFORM_SOLAR_ENGINE = "SolarEngine";
...
...
*/
// Replace with your attribution platform name, for example, "Adjust"
string attributionPlatformName = MBridgeRevenueParamsEntity.ATTRIBUTION_PLATFORM_ADJUST;
// Replace "userid" with your attribution platform UID
MBridgeRevenueParamsEntity mBridgeRevenueParamsEntity = new MBridgeRevenueParamsEntity(attributionPlatformName, "userid");
// impressionData: a instance of IronSourceImpressionData
mBridgeRevenueParamsEntity.SetIronSourceImpressionData(impressionData);
MBridgeRevenueManager.Track(mBridgeRevenueParamsEntity);
}
Using the AdRevenuePaidEvent Callback
// Example using a rewarded ad
MaxSdkCallbacks.Rewarded.OnAdRevenuePaidEvent += OnRewardedAdRevenuePaidEvent;
void OnRewardedAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{
/*
ATTRIBUTION_PLATFORM_APPSFLYER = "AppsFlyer";
ATTRIBUTION_PLATFORM_ADJUST = "Adjust";
ATTRIBUTION_PLATFORM_TENJIN = "Tenjin";
ATTRIBUTION_PLATFORM_SINGULAR = "Singular";
ATTRIBUTION_PLATFORM_KOCHAVA = "Kochava";
ATTRIBUTION_PLATFORM_BRANCH = "Branch";
ATTRIBUTION_PLATFORM_REYUN = "Reyun";
ATTRIBUTION_PLATFORM_SOLAR_ENGINE = "SolarEngine";
...
...
*/
// Replace with your attribution platform name, for example, "Adjust", and replace "userid" with your attribution platform UID
MBridgeRevenueParamsEntity mBridgeRevenueParamsEntity = new MBridgeRevenueParamsEntity(MBridgeRevenueParamsEntity.ATTRIBUTION_PLATFORM_ADJUST, "userid");
// adInfo: a instance of MaxSdkBase.AdInfo
mBridgeRevenueParamsEntity.SetMaxAdInfo(adInfo);
MBridgeRevenueManager.Track(mBridgeRevenueParamsEntity);
}
Using the OnRewardVideoImpression Callback for RewardVideo
// Example using a rewarded ad
TradplusRewardVideo.Instance().OnRewardVideoImpression += OnImpression;
void OnImpression(string adunit, Dictionary<string, object> adInfo)
{
#if TRADPLUS
// Replace with your attribution platform name, for example, "Adjust", and replace "userid" with your attribution platform UID
MBridgeRevenueParamsEntity mBridgeRevenueParamsEntity = new MBridgeRevenueParamsEntity(MBridgeRevenueParamsEntity.ATTRIBUTION_PLATFORM_ADJUST, "userid");
mBridgeRevenueParamsEntity.tradplusadInfo = adInfo;
MBridgeRevenueManager.Track(mBridgeRevenueParamsEntity);
#endif
}
Using ironsource as an example of a customized way to access ROAS
//Information not available may not be transmitted
MBridgeRevenueCustomAdData adData = new MBridgeRevenueCustomAdData();
//Name of attribution platform
adData.AttributionPlatformName = MBridgeRevenueParamsEntity.ATTRIBUTION_PLATFORM_UMENG;
//Attribution platform userid
adData.AttributionPlatformUserId = "123";
//Aggregation Platform UnitId
adData.MediationUnitId = "testInstanceid";
//Aggregation platform name, ironsource example
adData.MediationName = "ironsource";
//revenue
adData.Revenue = impressionData.revenue;
//Accuracy of prices
adData.Precision = impressionData.precision;
//adNetwork
adData.AdNetworkName = impressionData.adNetwork;
//currency unit
adData.Currency = impressionData.country;
//Type of advertisement
adData.AdType = impressionData.adUnit;
//Whether bidding
adData.IsBidding = true;
//DSPID
adData.DspId = "DspId";
//DSPName
adData.DspName = "DspName";
Dictionary<string, object> dic = new Dictionary<string, object>();
dic.Add("instanceId",impressionData.instanceId);
//Configuration of the advertised UNIT on display
adData.AdNetworkUnitInfo = dic;
//Get all the information about the advertisement
Dictionary<string, object> jsonDic = IronSourceJSON.Json.Deserialize(impressionData.allData) as Dictionary<string, object>;
adData.AllInfo = jsonDic;
MBridgeRevenueManager.TrackCustom(adData);
Version | Change Log | Publish Date |
---|---|---|
1.0.3 | Roas Unity Plugin supports custom aggregation platform reporting | 2024.02.02 |
1.0.2 | Support TradPlus | 2023.12.22 |
1.0.1 | Fix bugs | 2023.12.06 |
1.0.0 | Unity support for ROAS revenue data feedback APIs | 2023.08.30 |