Untitled

mail@pastecode.io avatar
unknown
plain_text
22 days ago
1.9 kB
3
Indexable
Never
        private void ImpressionDataReadyEvent(IronSourceImpressionData impressionData) {
            double value = (double)impressionData.revenue;
            Firebase.Analytics.Parameter[] AdParameters = {
                new Firebase.Analytics.Parameter("ad_platform", "ironSource"),
                new Firebase.Analytics.Parameter("ad_source", impressionData.adNetwork),
                new Firebase.Analytics.Parameter("ad_unit_name", impressionData.instanceName),
                new Firebase.Analytics.Parameter("ad_format", impressionData.adUnit),
                new Firebase.Analytics.Parameter("currency", "USD"),
                new Firebase.Analytics.Parameter("value", value),
            };
            LogAdImpression(AdParameters);
            Dictionary<string, string> dic = new Dictionary<string, string>();
            dic.Add(AFAdRevenueEvent.AD_UNIT, impressionData.instanceId);
            LogAdRevenue(impressionData.adNetwork, AppsFlyerAdRevenueMediationNetworkType.AppsFlyerAdRevenueMediationNetworkTypeIronSource, value, "USD", dic);
        }

        private void LogAdImpression(Firebase.Analytics.Parameter[] impressionParameters) {
            if (FirebaseManager.IsReady) {
                Firebase.Analytics.FirebaseAnalytics.LogEvent("ad_impression", impressionParameters);
            } else {
                _listTempImpressionData.Add(impressionParameters);
            }
        }

        public void LogAdRevenue(string adsNetwork, AppsFlyerAdRevenueMediationNetworkType networkType, double revenue, string currency, Dictionary<string, string> dictionary) {
            AppsFlyerAdRevenue.logAdRevenue(adsNetwork, networkType, revenue, currency, dictionary);
            BS_Utils.Log("==> Log ads revenue: NetworkName: " + adsNetwork + " - NetworkType: " + networkType + " - Revenue: " + revenue + " - Currency: " + currency + " - Dictionary: " + dictionary);
        }
Leave a Comment