Questions? Feedback? powered by Olark live chat software
Spring over navigation

Media Services: Google Analytics Plugin for Azure Media Player

Sidst opdateret: 01-12-2016
Bidragydere:
Rediger på GitHub

Google Analytics plugin for Azure Media Player

Google Analytics Dashboard

The following dashboards are created for your convenience, however you are more than welcome to create your own dashboard inside of Google Analytics. To use the provided dashboards, simply click on the URLs below, and when prompted, attach the correct data set associated with the data that is being collected in Azure Media Player.

Getting Started

Set up Azure Media Player in your web page. See the AMP documentation and samples

In your web page, add the AMP scripts to the head of your page, followed by the amp-ga.js script. Make sure to add your own Google Analytics tracking code: ```html

```

Loading the Plugin

You can provide options to the plugin either by passing them in the javascript or in the html.

var myOptions = {
    "nativeControlsForTouch": false,
    autoplay: true,
    controls: true,
    width: "640",
    height: "400",
    poster: "",
    plugins: {
        ga: {
            'eventsToTrack': ['playerConfig', 'loaded', 'playTime', 'percentsPlayed', 'start', 'end', 'play', 'pause', 'error', 'buffering', 'fullscreen', 'seek', 'bitrate'],
            'debug': false
        }
    }
};
var myPlayer = amp("azuremediaplayer", myOptions);
myPlayer.src([{ src: "//amssamples.streaming.mediaservices.windows.net/91492735-c523-432b-ba01-faba6c2206a2/AzureMediaServicesPromo.ism/manifest", type: "application/vnd.ms-sstr+xml" }, ]);

OR

<video id="azuremediaplayer" class="azuremediaplayer amp-default-skin amp-big-play-centered" controls autoplay width="640" height="400" poster="" data-setup='{"nativeControlsForTouch": false, "plugins": {"ga":{ "eventsToTrack": ["playerConfig", "loaded", "playTime", "percentsPlayed", "start", "end", "play", "pause", "error", "buffering", "fullscreen", "seek", "bitrate"], "debug": false}}}' tabindex="0">
    <source src="http://amssamples.streaming.mediaservices.windows.net/91492735-c523-432b-ba01-faba6c2206a2/AzureMediaServicesPromo.ism/manifest" type="application/vnd.ms-sstr+xml" />
    <p class="amp-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video</p>
</video>
video>

The plugin will take in priority options provided in the javascript, followed by the ones provided in html and finally the defaults.

Options

Check out the supported options

More information

This plugin supports the ga.js and the newer analytics.js Google Analytics libraries. It autodetects the library you use.

TODO

  • [ ] Issue reported with average load time
  • [ ] Track disposal of video element
  • [ ] Tracking Widevine protection info