Google IMA View
You can use the following code sample to work with Google IMA ad manager.
The code sample includes multiple client web pages or views illustrating each feature and a seventh code sample that shows all the features working in combination. To implement each client page, you will need all the standard elements that you normally use such as your API Key, pcode, and so forth.
Where to Find the CodeTo explore this code sample view in GitHub, go to https://github.com/ooyala/code-samples/blob/master/application/views/Secure_XDR_GoogleIMA/google_ima.php.
The following section describes the implementation of each of the Google IMA client-side view.
How the Google IMA Sample WorksTo examine how Google IMA works in this code sample, you need to look at the following files:
- application/config/ooyala_config (default_embed_code, default_player_id, google_ima_ad_tag)
- OO.Player.create() - In the sample, you should note that OO.Player.create is used with the google ad tag.
- google-ima-ads-manager - The google-ima-ads manager parameter is set in the hash of the OO.Player.create function. It takes an adTagUrl as part of a key value pair. In this sample, we pass the response from the PHP server containing the ad server URL.
- mb.subscribe - This function is used to subscribe to events and pass them to the console log.
Before you start working with the Ooyala Google IMA sample:
- You need to know what Google IMA does and how it works. For more information, see “Ads Embedded Parameters.”
- If you have an asset and want Google IMA, you must remember that Google IMA must be set on a per player basis.
- Associate your Google IMA ads with your video assets in Ooyala Backlot. For more information, see “Working with Your Own Ad Assets, Ad Sets, and Ad Sources.”
- Set up the Google IMA ad tags. You can also do this within Backlot. For more information, see “Working with Your Own Ad Assets, Ad Sets, and Ad Sources,” “Creating Ad Sets for Integration with Ad Sources,” and “Ad Set Fields for Google.”