Search...
Menu

Revenue Tracking

💡Tips

  • 🟢 This example uses interstitial ad format for demonstration. Other ad formats follow the same implementation logic
  • 🔵 Callback parameters are for reference only. Select appropriate parameters according to your business requirements

Firebase

  • ⚠️ When using Link AdMob to Firebase, avoid duplicate AdMob revenue reporting
  • The following sample code is for reference only. For detailed information, please refer to the official Firebase documentation
java Copy
mInterstitialAd.setRevenueListener(new MCAdRevenueListener() {  
    @Override  
    public void onAdRevenuePaid(MCAdInfo adInfo) {  
        // Prevent duplicate AdMob reporting  
        // if ("Admob".equalsIgnoreCase(adInfo.getNetworkFirmName())) return;  
        
        FirebaseAnalytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(mActivity);  
        Bundle params = new Bundle();  
        
        // Platform type determination  
        int mediationId = adInfo.getMediationId();  
        String adPlatform = mediationId == MCAdConst.MediationId.MEDIATION_ID_TOPON ? "TopOn" :  
                (mediationId == MCAdConst.MediationId.MEDIATION_ID_MAX ? "Max" : "Your Platform Name");  
        
        // Revenue parameter configuration  
        params.putString(FirebaseAnalytics.Param.AD_PLATFORM, adPlatform);  
        params.putString(FirebaseAnalytics.Param.AD_SOURCE, adInfo.getNetworkFirmName());  
        params.putString(FirebaseAnalytics.Param.AD_FORMAT, adInfo.getFormat().getLabel());  
        params.putString(FirebaseAnalytics.Param.AD_UNIT_NAME, adInfo.getNetworkPlacementId());  
        params.putDouble(FirebaseAnalytics.Param.VALUE, adInfo.getRevenue());  
        params.putString(FirebaseAnalytics.Param.CURRENCY, adInfo.getCurrency());  
        
        mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.AD_IMPRESSION, params);  
    }  
});  

Adjust

  • The following sample code is for reference only. For detailed information, please refer to the official Adjust documentation
java Copy
mInterstitialAd.setRevenueListener(new MCAdRevenueListener() {  
    @Override  
    public void onAdRevenuePaid(MCAdInfo adInfo) {  
        int mediationId = adInfo.getMediationId();  
        String adPlatform = mediationId == MCAdConst.MediationId.MEDIATION_ID_TOPON ? "TopOn" :  
                (mediationId == MCAdConst.MediationId.MEDIATION_ID_MAX ? "Max" : "Your Platform Name");  
        AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue(adPlatform);  

        // Revenue parameter configuration  
        adjustAdRevenue.setRevenue(adInfo.getRevenue(), adInfo.getCurrency());  
        adjustAdRevenue.setAdRevenueNetwork(adInfo.getNetworkFirmName());  
        adjustAdRevenue.setAdRevenueUnit(adInfo.getNetworkPlacementId());  
        adjustAdRevenue.setAdRevenuePlacement(adInfo.getMediationPlacementId());  
        
        Adjust.trackAdRevenue(adjustAdRevenue);  
    }  
});  

AppsFlyer

  • The following sample code is for reference only. For detailed information, please refer to the official AppsFlyer documentation
java Copy
mInterstitialAd.setRevenueListener(new MCAdRevenueListener() {  
    @Override  
    public void onAdRevenuePaid(MCAdInfo adInfo) {  
        AppsFlyerLib appsflyer = AppsFlyerLib.getInstance();  
        MediationNetwork mediationNetwork = adInfo.getMediationId() == MCAdConst.MediationId.MEDIATION_ID_TOPON ? MediationNetwork.TOPON :  
                (adInfo.getMediationId() == MCAdConst.MediationId.MEDIATION_ID_MAX ? MediationNetwork.APPLOVIN_MAX : MediationNetwork.CUSTOM_MEDIATION);  
        AFAdRevenueData adRevenueData = new AFAdRevenueData(adInfo.getNetworkFirmName(),  
                mediationNetwork,  
                adInfo.getCurrency(),  
                adInfo.getRevenue()  
        );  

        // Revenue parameter configuration  
        Map<String, Object> additionalParams = new HashMap<>();  
        additionalParams.put(AdRevenueScheme.COUNTRY, adInfo.getCountry());  
        additionalParams.put(AdRevenueScheme.AD_UNIT, adInfo.getNetworkPlacementId());  
        additionalParams.put(AdRevenueScheme.AD_TYPE, adInfo.getFormat().getLabel());  
        additionalParams.put(AdRevenueScheme.PLACEMENT, adInfo.getMediationPlacementId());  
        
        AppsFlyerLib.getInstance().logAdRevenue(adRevenueData, additionalParams);  
    }  
});  

SolarEngine

  • The following sample code is for reference only. For detailed information, please refer to the official SolarEngine documentation
  • The parameter description for the SEAdImpEventModel class shall be based on the official parameter specifications
java Copy
mInterstitialAd.setRevenueListener(new MCAdRevenueListener() {
    @Override
    public void onAdRevenuePaid(MCAdInfo adInfo) {
        SEAdImpEventModel seAdImpEventModel =  new SEAdImpEventModel();
        //Monetization Platform Name
        String adNetworkPlatform = adInfo.getNetworkFirmName();
        //Please map the value of `adNetworkPlatform` to the String value defined in the official SEAdImpEventModel parameter specifications before use
        seAdImpEventModel.setAdNetworkPlatform("adNetworkPlatform");
        //Mediation Platform Name
        String mediationPlatform = adInfo.getMediationName();
        //Please map the value of `mediationPlatform` to the String value defined in the official SEAdImpEventModel parameter specifications before use
        seAdImpEventModel.setMediationPlatform("mediationPlatform");
        //Displayed Ad Type (If interstitial ad, adType = 3)
        seAdImpEventModel.setAdType(3);
        //Monetization Platform App ID (optional) You can input the appKey in SE SDK.
        seAdImpEventModel.setAdNetworkAppID("---SE SDK的appKey---");
        //Monetization Platform Ad Unit ID
        seAdImpEventModel.setAdNetworkADID(adInfo.getNetworkPlacementId());
        //Ad eCPM
        seAdImpEventModel.setEcpm(adInfo.getEcpm());
        //Monetization Platform Currency Type (USD)
        seAdImpEventModel.setCurrencyType(adInfo.getCurrency());
        //True: rendered success
        seAdImpEventModel.setRenderSuccess(true);
        //You can add custom properties as needed. Here we do not give examples.
        SolarEngineManager.getInstance().trackAdImpression(seAdImpEventModel);
    }
});

Previous
Preset Strategy
Next
Privacy Policy
Last modified: 2025-12-17Powered by