LogoLogo
HomeThe PlatformBlogSchedule a demo
  • Getting Started
    • Welcome to AdLibertas
  • The Platform
    • How it works
    • User-Level Audience Reporting
      • Creating Reports
        • Creating a New User Report
        • Creating Advanced User-Level Reports
        • Advanced Audience Builder
        • Custom Event Metrics
      • Report Layout
        • Report Module: Audience Filtering
        • Chart Type Module: Absolute vs. Relative Reports
        • Daily Totals, Per User, Cumulative Totals
        • Lifecycle Reports
        • Forecasting Module
        • Statistics Module
        • Measuring Confidence
      • Advanced Reporting Methods
        • User Measurement & Calculation Details
        • Date Ranges: Define Audience vs. Create Report
        • Exclude GAID tracking opt-outs
        • Scheduled Reports: Keep Updated & Rolling
        • Reporting on a Firebase AB test
        • Understanding “Audience Restraints”
        • Adding user time to your reports
    • Consolidated Revenue Reporting
      • Reporting Discrepancies
      • Reporting Availability & Timezones
      • Ad Network Re-Repost; Also: Revenue Reconciliation Accuracy
      • Consolidated Reporting vs. Consolidated Inventory Reporting
      • Reporting Table – Column Descriptions Common Metrics (Calculated Fields)
      • Facebook Reporting
      • Consolidated Ad Revenue with multiple mediators
    • Business Analytics
      • Analytics Layout
      • Understanding the "Explore Data" button
      • The Data Table
      • Asking a Question
      • Saving a Question
      • Creating a custom dimension
      • Setting up a pulse
    • Custom Dashboards
      • Custom Dashboard Filters
      • Combining data into a single chart
    • Direct SQL Access
    • Exporting Data
      • Ad Network Reports
      • Chart Reports
      • Custom API connections
      • Downloading & Scheduling Data Reports
      • Deprecated: Line Item Change Log
    • General
      • Change your Username & Password
      • Adding Users to your Account
      • Sharing Collaborative Links
      • AdLibertas Cost
  • Data Integrations
    • Connecting in 3 steps
    • Ad Impression-Level Revenue Connections
      • AppLovin Max User Revenue API
      • ironSource Ad Revenue Measurement Integration
      • Impression level tracking with Admob Mediation
      • Collecting MoPub Impression-Level Data as a Firebase Event
    • Ad Network & Store Connections
      • Adding Ad Network Credentials
      • How does App Store Reporting work?
      • Adding access to Google Play
      • Adding Sub User to App Store Connect
      • Getting the most from Ad Network Reports
    • Analytics Connections
      • Data Set Status
      • Connect AdLibertas to Firebase
      • Connecting AdLibertas to BigQuery
      • Firebase Install Counts in Audience Reporting
      • Setting User Campaigns in Firebase
      • Why use revenue to determine Firebase AB test winners?
      • Firebase Best Practices: keeping Google BigQuery Costs Down
    • Custom Integrations
      • Sending Events via Webhooks to AdLibertas
      • Impression level tracking with Admob Mediation
      • Connecting AdLibertas to BigQuery
      • Importing a custom data set
    • IAP Connections
      • Tracking IAP & Subscriptions in Firebase and BigQuery
      • RevenueCat Integration: WebHooks
      • RevenueCat: Setting Universal Identifiers
    • MMP Connections
      • Connecting Adjust
      • Connecting AppsFlyer
      • Connecting Kochava
  • FAQs
    • General
      • Why does AdLibertas need credentials?
    • Audience Reporting
      • Why doesn't my daily active user count match Firebase?
      • Why doesn’t my retention rate match?
      • Why aren't my install rates matching?
      • Why doesn't my relative user count match retention?
      • What is the probability projected LTV becomes actual LTV?
      • Why doesn’t Firebase and AdLibertas revenue match?
    • Reporting
      • What is “non_mopub” revenue
      • How do customers use AdLibertas?
  • Privacy & Security
    • Privacy & Security Details
Powered by GitBook
On this page
  • 1. Enabling Impression-level Revenue Data (ILRD):
  • 2. Integrate listeners to collect post-back
  • 3. Relay the information as an event to Firebase
  1. Data Integrations
  2. Ad Impression-Level Revenue Connections

Collecting MoPub Impression-Level Data as a Firebase Event

Today MoPub doesn’t offer an API providing impression-level events. The information is only allowed as a post-back to the app.

One of the easiest ways to track MoPub impression-level data is by enabling Firebase to collect ad impressions as events. This article outlines the recommended methods for doing so.

Summary:

  1. Enable ILRD

  2. Integrate listeners to collect the post-back

  3. Send the information as a Firebase Event.

1. Enabling Impression-level Revenue Data (ILRD):

First, data will only be sent to SDK versions v5.7.0 or higher.

Below is MoPub’s documentation on the latest versions:

  • Android

  • iOS

  • Unity

Contact your MoPub account representative to enable ILRD. If you’re not assigned an account manager you can send an email to support@mopub.com to request this feature.

2. Integrate listeners to collect post-back

The ILRD event is sent as a JSON blob, to collect the JSON delivered with the ad impression you’ll need to add listeners to capture, parse and relay the information to Firebase:

  • Android

  • iOS

  • Unity

3. Relay the information as an event to Firebase

Note, we recommend you send all information provided with the impression:

iOS – Sending MoPub ILRD to Firebase

- (void)mopubAd:(id<mpmopubad>)ad didTrackImpressionWithImpressionData:(MPImpressionData * _Nullable)impressionData
{

// Feed impression data into internal tools or send to third-party analytics
    if (impressionData != nil)
    {
     [FIRAnalytics logEventWithName:kFIREventAdImpression
      parameters:@{
        kFIRParameterAdPlatform:@”MoPub”,
        kFIRParameterAdUnitName:impressionData.adUnitName,   
        kFIRParameterAdFormat:impressionData.adunitFormat,
        kFIRParameterValue:impressionData.publisherRevenue,
        kFIRParameterCurrency:impressionData.currency,
        kFIRParameterAdSource:impressionData.networkName,
        @“precision”:impressionData.precision
        }];
    }
}</mpmopubad>

Android – Sending MoPub ILRD to Firebase

@Override
public void onImpression(@NonNull final String adUnitId, @Nullable final ImpressionData impressionData) {

  if (impressionData != null) {
    // Feed impression data into internal tools or send to third-party analytics
    FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(context);

    Bundle params = new Bundle();
    params.putString(FirebaseAnalytics.Param.AD_PLATFORM, “MoPub”);
    params.putString(FirebaseAnalytics.Param.AD_SOURCE, impressionData.network_name);
    params.putString(FirebaseAnalytics.Param.AD_FORMAT, impressionData.adunit_format);
    params.putString(FirebaseAnalytics.Param.AD_UNIT_NAME, impressionData.adunit_name);
    params.putString(FirebaseAnalytics.Param.VALUE, impressionData.publisher_revenue);
    params.putString(FirebaseAnalytics.Param.CURRENCY, impressionData.currency);
    params.putString("precision", impressionData.precision);
    mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.AD_IMPRESSION, params);
  }

}

Unity – Sending MoPub ILRD to Firebase

// REGISTER TO LISTEN TO THE EVENT FROM MOPUB SDK
    private void OnEnable() {
        MoPubManager.OnImpressionTrackedEvent += OnImpressionTrackedEvent;
    }

    private void OnImpressionTrackedEvent(string adUnitId, MoPub.ImpressionData impressionData)
    {
        // Feed impression data into internal tools or send to third-party analytics
        if (impressionData != null) {
          var myImpressionObject = JsonUtility.FromJson<ImpressionObject>(impressionData.JsonRepresentation);
          var impressionParameters = new[] {
              new Firebase.Analytics.Parameter("ad_platform", “MoPub”),
              new Firebase.Analytics.Parameter("ad_source", myImpressionObject.network_name),
              new Firebase.Analytics.Parameter("ad_unit_name", myImpressionObject.adunit_name),
              new Firebase.Analytics.Parameter("ad_format", myImpressionObject.adunit_format),
              new Firebase.Analytics.Parameter("value", myImpressionObject.publisher_revenue),
              new Firebase.Analytics.Parameter("currency", myImpressionObject.currency),
              new Firebase.Analytics.Parameter("precision", myImpressionObject.precision)
          };
          Firebase.Analytics.FirebaseAnalytics.LogEvent("ad_impression", impressionParameters);
        }
    }

    [Serializable]
    public class ImpressionObject
    {
        public string adunit_id;
        public string adunit_name;
        public string adunit_format;
        public string app_version;
        public string id;
        public string currency;
        public string publisher_revenue;
        public string network_name;
        public string network_placement_id;
        public string adgroup_id;
        public string adgroup_name;
        public string adgroup_type;
        public string adgroup_priority;
        public string country;
        public string precision;
    }
PreviousImpression level tracking with Admob MediationNextAd Network & Store Connections

Last updated 3 years ago