Enabling Bitmovin Analytics
The Bitmovin Player already comes with Bitmovin analytics integrated. By default analytics collections is disabled. To enable analytics, an analyticsConfig
with an valid analytics license key must be specified. In order to get analytics up and running, add the following configuration options to your PlayerConfig:
const player = usePlayer({
analyticsConfig: {
// Bitmovin analytics key from the Analytics Dashboard
key: '<ANALYTICS-KEY>', // `key` is the only required parameter.
// Whether the user ID should be randomly generated or not. Default value is false.
randomizeUserId: false,
// Whether collector should also collect statistics about ads
// Can be changed to `true` in case advertising is not used.
// Default is false.
adTrackingDisabled: false,
defaultMetadata: {
// Asset CDN provider. Check out `CdnProvider` on `src/analytics/config.ts` for more options.
cdnProvider: CdnProvider.AKAMAI,
// User-defined user ID.
customUserId: 'Custom user ID',
// Experiment name that will appear at the Analytics Dashboard.
experimentName: 'Experiment name',
// List of custom data fields to be registered at the Analytics Dashboard.
// Useful to customize collection with your own data along with the SDK.
customData1: 'Custom data field 1',
customData2: 'Custom data field 2',
customData3: 'Custom data field 3',
customData4: 'Custom data field 4',
customData5: 'Custom data field 5',
// Usage of customData properties are supported up to 30 fields
customData30: 'Custom data field 30',
},
},
});
With that you should already start seeing analytics information about your Player instance in the Analytics Dashboard.
Optionally, you can also specify analyticsSourceMetadata
on player sources. In order to distinguish separate sources on your player, add the following configuration options to your SourceConfig
:
player.load({
url: 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8',
type: SourceType.HLS,
title: 'Art of Motion',
poster: 'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/poster.jpg',
analyticsSourceMetadata: {
// Video ID on your server
videoId: 'MyVideoId',
// Video title
title: 'Art of Motion',
// Whether this is a live stream video. Default is false.
isLive: false,
// Navigation breadcrumb.
// The path taken by the user inside your application.
path: '/examples/basic_analytics',
// customData fields and experimentName can be overriden separately,
// else the values of the `defaultMetadata` are used
customData1: 'Custom data field 1 from source',
experimentName: 'Experiment Name Override',
},
});
You can find a complete analytics example in the example app.
Updated about 1 year ago