Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.4 kB
2
Indexable
Never
 public static void ReportRevenue_Applovin(MaxSdkBase.AdInfo maxAd, AdFormat format)
    {
        double revenue = maxAd.Revenue;
        if (FirebaseManager.hasInitialized)
        {
            var impressionParameters = new[] {
            new Parameter("ad_platform", "AppLovin"),
            new Parameter("ad_source", maxAd.NetworkName),
            new Parameter("ad_unit_name",$"{format}_{GetMaxNetworkType(maxAd.NetworkName)}_{maxAd.WaterfallInfo.TestName}_{maxAd.AdUnitIdentifier}"),
            new Parameter("ad_format","Applovin_" + format.ToString()),
            new Parameter("value", revenue),
            new Parameter("currency", "USD"), // All AppLovin revenue is sent in USD
            (format == AdFormat.Interstitial || format == AdFormat.Rewarded) ? new Parameter("ad_placement", PlacementName.ToLower()) : new Parameter("no_placement", "nothing")
            };

            FirebaseAnalytics.LogEvent("ad_impression", impressionParameters);
        }

        //Rev Event for Adjust
        AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue(AdjustConfig.AdjustAdRevenueSourceAppLovinMAX);
        adjustAdRevenue.setRevenue(revenue, "USD");
        adjustAdRevenue.setAdRevenueNetwork(maxAd.NetworkName);
        adjustAdRevenue.setAdRevenueUnit($"{format}_{maxAd.AdUnitIdentifier}");
        Adjust.trackAdRevenue(adjustAdRevenue);

    }
Leave a Comment