Should be a central configuration in the SDK that contains a mapping of dimension[1,2,33,44,etc] to what metadata key they should be using to retrieve the value.
For instance, given the following central config mapping:
{
dimension45: 'video_id'
}
The assumption can be made that a metadata object, when referenced inside the GA module, can assign dimension45
as follows:
let someMetadataObject = { video_id: 12345 };
// GA assignment
const dimensions = {
dimension45: someMetadataObject.video_id
};
ga('set', 'dimensions', dimensions);
The configuration should contain metadata keys for all custom dimensions referenced in the FMG Video Events google doc here (https://docs.google.com/spreadsheets/d/1J650M0T-_iBLixzHuxq_MxUk3-T5KI13BFPCpEqi07M/edit#gid=615414060)
For instance, on this line of mcpVideoPlayer.es6
:
we're calling playVOD
:
FMG.playVOD(videoConfig);
We should be able to pass into videoConfig
any keys we want to be used, e.g.
FMG.playVOD({ metadata: { videoId: 12345, embedLocation: 'featured', contentType: 'permalink' } });
The metadata is set once the ajax promise resolves here: https://github.com/univision/FMG-Video-SDK/blob/41799d589ebee21b6b6d639429510d02d7042503/src/app/scripts/modules/video-metadata-hub.js#L34
Snippet:
this.metadata[isPlaylist][mcpId] = promise = GlobalConfig.$.ajax(request);
Certain fields (like Video Length Seconds
) should be provided as part of the video metadata hub response and mapped accordingly to GA dimensions
Another example, should be the Video Player Name & Version
. For instance, JWPlayer-7.12.6
.
All of the events we should be capturing are defined in the FMG Video Events doc here (https://docs.google.com/spreadsheets/d/1J650M0T-_iBLixzHuxq_MxUk3-T5KI13BFPCpEqi07M/edit#gid=1463713420).
If it's helpful, several of these are already implemented as separate modules inside of the Onion bulbs-elements repo (with tests):
The FMG SDK should provide a config option to pass in a GA tracker name, but default to using none, e.g.: None
window.ga('send', 'event', 'Video Play', 'action desc', 'label');
Option player-mcp-12345
passed in:
let playerConfig = {
googleAnalyticsTracker: 'player-mcp-12345'
};
FMG.playVOD(playerConfig);
Results in the following convention for events fired through the SDK GA module:
window.ga('player-mcp-12345.send', 'event', 'Video Play', 'action desc', 'label');