Appsflyer + firebase rev events

attached with paid events callback
 avatar
saddam
plain_text
a year ago
2.4 kB
13
Indexable
Never
    public static void Revenue_ReportAdmob(AdValue admobAd, AdFormat format)
    {
        double revenue = (admobAd.Value / 1000000f);
        if (InitializeFirebase.hasInitialized)
        {
            var impressionParameters = new[] {
            new Firebase.Analytics.Parameter("ad_platform", "Admob"),
            new Firebase.Analytics.Parameter("ad_source", "Simple Admob"),
            //new Firebase.Analytics.Parameter("ad_unit_name", ""+AssignAdIds_CB.instance.admobBanner),
            new Firebase.Analytics.Parameter("ad_format", "Admob_" + format.ToString()),
            new Firebase.Analytics.Parameter("value", revenue),
            new Firebase.Analytics.Parameter("currency", admobAd.CurrencyCode),
            };

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

        Dictionary<string, string> dic = new Dictionary<string, string>();
        dic.Add("ad_format", "admob_" + format.ToString());
        AppsFlyerAdRevenue.logAdRevenue("simple_admob", AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeGoogleAdMob, revenue, "USD", dic);

    }

    public static void Revenue_ReportApplovin(MaxSdkBase.AdInfo maxAd, AdFormat format)
    {
        double revenue = maxAd.Revenue;
        if (InitializeFirebase.hasInitialized)
        {
            var impressionParameters = new[] {
            new Firebase.Analytics.Parameter("ad_platform", "AppLovin"),
            new Firebase.Analytics.Parameter("ad_source", maxAd.NetworkName),
            new Firebase.Analytics.Parameter("ad_unit_name", maxAd.AdUnitIdentifier),
            new Firebase.Analytics.Parameter("ad_format","Applovin_" + format.ToString()),
            new Firebase.Analytics.Parameter("value", revenue),
            new Firebase.Analytics.Parameter("currency", "USD"), // All AppLovin revenue is sent in USD
            };

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

        Dictionary<string, string> dic = new Dictionary<string, string>();
        dic.Add("ad_unit_name", maxAd.AdUnitIdentifier);
        dic.Add("ad_format", "applovin_" + format.ToString());
        AppsFlyerAdRevenue.logAdRevenue(maxAd.NetworkName, AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeApplovinMax, revenue, "USD", dic);


    }