AMP player

Akamai Media Analytics

Avoiding manual implementation of media-related beacons is this module’s goal, our implementation uses our own AMP callbacks to notify Media Analytics so you don’t have to.


Just import the AmpMediaAnalytics.framework in your project. For more information check out the AmpCore’s documentation.

Note: Make sure to add the frameworks as Embedded Binaries or you’ll get an error about a missing image.

How to Use Let’s first import the required frameworks:

import AmpCore
import AmpMediaAnalytics

Then, let’s add the related variables in our UIViewController:

var ampPlayer: AmpPlayer!
var ampMediaAnalytics: AmpMediaAnalyticsManager!

And it’s time to instantiate them now, in your viewDidLoad function:

// Instantiate player
self.ampPlayer = AmpPlayer(parentView: self.view)
self.ampPlayer.autoplay = true

// Register yourself as an observer if required

// Define your desired dimensions, these are some test ones:
let customDimensions = [
    "title": "AKaMTitle",
    "category": "AKamCategory",
    "playerId": "AKAM AVPlayer playerId",
    "device": "AKAM AVPlayer device",
    "show": "AKAM AVPlayer$show"

// Instantiate the Media Analytics Manager
self.ampMA = AmpMediaAnalyticsManager(ampPlayer: self.ampPlayer, configUrl: analyticsUrl, customDimensions: customDimensions)

// Afterwards, let's ask our `ampPlayer` to handle our stream YOUR_VIDEO_URL)

And that’s basically it, with just those few steps, you have a working integration between AMP and Media Analytics.