# Google IMA (Ads)

ATTENTION

The Unified Plugin does not support CDN Balancer module for ExoPlayer IMA Extensions

Unified Plugin SDK can be easily integrated with Google IMA to show Ads.

# Initialise the Ads Adapter

Google IMA can be integrated using two different methods, using the client-side SDK or the dynamic ad insertion (DAI) SDK .

# Integration with the Client-side SDK

You will need the ads manager object and the URL of your JSON adapter:

INFO

To get the adapter url, please contact your customer engineer manager or customer success manager.

// Your onAdsManagerLoaded method from the Google IMA integration
function onAdsManagerLoaded(adsManagerLoadedEvent) {
    // ...
    adsManager = adsManagerLoadedEvent.getAdsManager(videoElement);
    unifiedPlugin.registerAdsAdapter(adsManager, '<google_ima_adapter_url>');
    // ...
}

// Your onAdError method from the Google IMA integration
function onAdError(adErrorEvent) {
  // ...
  if(adsManager) {
    adsManager.destroy();
    unifiedPlugin.removeAdsAdapter();
  }
  // ...
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

WARNING

Be sure to call removeAdsAdapter everytime you destroy the adsManager object.

At this point, your integration of the Unified Plugin is concluded.

After running your appplication, you should see your metrics appearing in your Codavel Panel dashboards.

# Integration with the Dynamic Ad Insertion SDK

You will need the Stream Manager object and the URL of your JSON adapter:

// ...
streamManager = new google.ima.dai.api.StreamManager(videoElement);
unifiedPlugin.registerAdsAdapter(streamManager, '<google_ima_adapter_url>');
// ...
1
2
3
4

At this point, your integration of the Unified Plugin is concluded.

After running your appplication, you should see your metrics appearing in your Codavel Panel dashboards.

# Further Customizations

The plugin allows you to configure different parameters in your integration, such as the metadata of the ads playing. Detailed explanations of these options are available here.

Updated: 7/6/2023, 3:26:38 PM