- 3 Minutes to read
- Print
- DarkLight
Media Events
- 3 Minutes to read
- Print
- DarkLight
The key figures for the media streams are calculated by the media actions and the transferred positions. You must, therefore, ensure that the requests are sent in the correct order. For example, no actions will be measured until a mediaPlay request is made for the video.
If you are using custom parameters or categories, please note that with AMP, you need to include the parameters in every action call via the extraUrlParams parameter (see also Media Categories).
Start a Multimedia File
The request "mediaPlay" is used for the playback of a video and start of the media session.
Example
<amp-analytics type="mapp_intelligence">
<script type="application/json">
{
"vars": {
"trackDomain": "analytics.mapp.com",
"trackId": "111111111111111"
},
"triggers": {
...
"trackMediaPlay": {
"on": "video-play",
"request": "mediaPlay",
"selector": "#video"
},
...
}
}
</script>
</amp-analytics>
Parameter or Attribute | Description |
---|---|
"request": "mediaPlay" | You must set the value of the request parameter to mediaPlay to send the correct parameter to Mapp Intelligence. The request mediaPlay is used to record the playback of the multimedia file. This action is also sent when a file is autostarted or when the [Play] button of the media player is clicked.
|
Current Position of a Multimedia File
The request mediaPosition should be sent regularly every 30 seconds. It is used for tracking the viewed chapters of a video and the last position of the video, in case the user ends the video by closing the browser tab/window.
This action should be sent when the media player is in play mode. Once the video is paused or stopped, the timer for sending these actions must be stopped.
Example
<amp-analytics type="mapp_intelligence">
<script type="application/json">
{
"vars": {
"trackDomain": "analytics.mapp.com",
"trackId": "111111111111111"
},
"triggers": {
...
"trackMediaSecondsPlayed": {
"on": "video-seconds-played",
"request": "mediaPosition",
"selector": "#video",
"videoSpec": {
"interval": 30
}
},
...
}
}
</script>
</amp-analytics>
Parameter or Attribute | Description |
---|---|
"request": "mediaPosition" | Specifies the request value to be sent. You need to set it to "mediaPosition" to send the correct event to Mapp Intelligence. In the above example, the request "mediaPosition" is sent regularly at intervals of 30 seconds and is used to capture the sections viewed and the last position in case the user terminates the video by closing the browser window. When the video is paused or stopped, the timer is also paused to send this action. |
"videoSpec": {"interval": 30} | Specifies the interval the requests are sent to Mapp Intelligence.
|
Pause a Multimedia File
The request mediaPause must be sent with a click on the Pause button in the media player. Do not send any other position action while in pause mode.
Example
<amp-analytics type="mapp_intelligence">
<script type="application/json">
{
"vars": {
"trackDomain": "analytics.mapp.com",
"trackId": "111111111111111"
},
"triggers": {
...
"trackMediaPause": {
"on": "video-pause",
"request": "mediaPause",
"selector": "#video"
},
...
}
}
</script>
</amp-analytics>
Parameter or Attribute | Description |
---|---|
"request": "mediaPause", | The request mediaPause is sent when clicking the [Pause] button. In pause mode, no further position requests will be sent. |
Ending a Multimedia File
The request mediaPause must be sent with a click on the Pause button in the media player. Do not send any other position action while in pause mode.
Example
<amp-analytics type="mapp_intelligence">
<script type="application/json">
{
"vars": {
"trackDomain": "analytics.mapp.com",
"trackId": "111111111111111"
},
"triggers": {
...
"trackMediaPause": {
"on": "video-pause",
"request": "mediaPause",
"selector": "#video"
},
...
}
}
</script>
</amp-analytics>
Parameter or Attribute | Description |
---|---|
"request": "mediaPause", | The request mediaPause is sent when clicking the [Pause] button. In pause mode, no further position requests will be sent. |
Custom Media Events
You can define custom media events, for example, to track ad playback.
<amp-analytics type="mapp_intelligence">
<script type="application/json">
{
"vars": {
"trackDomain": "analytics.webtrekk.net",
"trackId": "111111111111111"
},
"triggers": {
...
{
"trackMediaAdStart": {
"on": "video-ad-start",
"request": "mediaCustomEvent",
"selector": "#video",
"vars": {
"mediaEventName": "ad-start"
},
"extraUrlParams": {
"mg1": "AMP Media Category 1",
"ck1": "AMP Mediatracking Event Parameter 1 - PAUSE",
"cs1": "AMP Mediatracking Session Parameter 1",
"cb1": "AMP Mediatracking eCommerce Parameter 1"
}
},
"trackMediaAdEnd": {
"on": "video-ad-end",
"request": "mediaCustomEvent",
"selector": "#video",
"vars": {
"mediaEventName": "ad-end"
},
"extraUrlParams": {
"mg1": "AMP Media Category 1",
"ck1": "AMP Mediatracking Event Parameter 1 - PAUSE",
"cs1": "AMP Mediatracking Session Parameter 1",
"cb1": "AMP Mediatracking eCommerce Parameter 1"
}
}
}
...
}
}
</script>
</amp-analytics>
Parameter | Description |
---|---|
mediaEventName | You can define your custom media event here |