-
Notifications
You must be signed in to change notification settings - Fork 0
AV Insights 34dcb6
In order to benefit from AV Insights you should first activate the feature. If you want to activate it please contact our support centre.
The AV Insights plugin allows the collection of events related to media consumption on your site. You will be able to follow the different interactions on your players and measure the performance of your content.
In order to be able to manipulate a media and measure its events, it is necessary to declare an object of type AVMedia :
let tracker = ATInternet.sharedInstance.defaultTracker
/// Property
/// let myMedia = tracker.avInsights.media
let myMedia = tracker.avInsights.Media(heartbeat: 5, bufferHeartbeat: 5)
Two parameters are available, in order to activate the automatic heartbeats. The first one enables playback tracking heartbeats and the second one enables buffering tracking heartbeats. The values provided are no longer used, the heartbeat evolution steps are now defined by us. The presence of the values will only activate the functionality.
The “heartbeat” is a refresh interval that changes automatically during playback.
An optional third parameter
sessionIdis available since Tracker version2.19.0to override the common standard propertyav_session_idpresent in each event generated by AV Insights tags. Please note that this parameter should be used only in special cases when you need to transfer sessions between different device.
The parameter is automatically generated by the Tracker for all standard cases.
let tracker = ATInternet.sharedInstance.defaultTracker
let myMedia = tracker.avInsights.Media(heartbeat: 5, bufferHeartbeat: 5, sessionId: "custom_session_id")
A property sessionId can be used to retrieve the value of the parameter:
sessionId() ⇒
String
Retrieve the session ID.
Example
let sessionID = myMedia.sessionId // "custom_session_id" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
Some rules must be observed regarding the format of the properties used for the configuration of a media :
- The syntax of the basic properties allowing to characterize a media must be respected (possible presence of underscore
_characters; see the exhaustive list of properties at the bottom of the page). - The
$symbol is a reserved symbol that must not be used in the name of a property. - The duration of the media or the positions of the playback head must be expressed in milliseconds.
The plugin provides a series of useful functions for the management of Media properties:
set(key: String, value: Any)
Declare a media property.
| Param | Type | Description |
| key | String |
Media property key |
| value | Any |
Media property value |
Example
_ = myMedia.set(key: "av_content", value: "my_video")
_ = myMedia.set(key: "av_content_id", value: 12345)
get(key: String) ⇒
Any?
Retrieve a media property.
| Param | Type | Description |
| key | String |
Media property key |
Example
let contentId = myMedia.get(key: "av_content_id") // 12345
del(key: String)
Delete a media property.
| Param | Type | Description |
| key | String |
Media property key |
Example
myMedia.del(key: "av_content_id")
setProps(obj: [String: Any])
Declare multiple media properties.
| Param | Type | Description |
| properties | [String: Any] |
Media properties |
Example
myMedia.setProps(obj: [
"av_content": "My Content",
"av_content_id": "fg456"
])
getProps() ⇒
[String: Any]
Retrieve multiple media properties.
Example
let props = myMedia.getProps() // {"av_content_id": "fg456", "av_content": "My Content"}
delProps()
Delete multiple media properties.
Example
myMedia.delProps()
When changing the playback speed you have to use the method setPlaybackSpeed() specifying the new speed factor as a decimal number.
setPlaybackSpeed(playbackSpeed: Double)
Declare a change in playback speed.
| Param | Type | Description |
| playbackSpeed | Double |
Playback speed factor |
Example
myMedia.setPlaybackSpeed(playbackSpeed: 2.0); // Media playback speed increased by a factor of two
The new playback speed factor will be taken into account when calculating the cursor positions of automated
heartbeatsevents during playback.If necessary, you can tag the event associated with this speed change by using the
myMedia.speed()method.
The Insights AV Plugin offers a series of useful functions for measuring events related to your users’ interactions with your content:
Event name : av.buffer.start or av.rebuffer.start
bufferStart(cursorPosition: Int, extraProps: [String: Any]?)
Generate an event of buffering at the launch of a media or during the playing.
A buffering flag will automatically generate buffering.heartbeat or rebuffering.heartbeat events depending on the context.
| Param | Type | Description |
| cursorPosition | Int |
Current cursor position (ms) |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.bufferStart(
cursorPosition: 0,
extraProps: ["customProp": "customValue"]
)
Event name : av.play
play(cursorPosition: Int, extraProps: [String: Any]?)
Generate a play event (playback attempt).
| Param | Type | Description |
| cursorPosition | Int |
Current cursor position (ms) |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.play(
cursorPosition: 0,
extraProps: ["customProp": "customValue"]
)
Event name : av.pause
playbackPaused(cursorPosition: Int, extraProps: [String: Any]?)
Generate a pause event.
| Param | Type | Description |
| cursorPosition | Int |
Current cursor position (ms) |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.playbackPaused(
cursorPosition: 1000,
extraProps: ["customProp": "customValue"]
)
Event name : av.resume
playbackResumed(cursorPosition: Int, extraProps: [String: Any]?)
Generate a resume event, following a pause event.
| Param | Type | Description |
| cursorPosition | Int |
Current cursor position (ms) |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.playbackResumed(
cursorPosition: 1000,
extraProps: ["customProp": "customValue"]
)
Event name : av.start
playbackStart(cursorPosition: Int, extraProps: [String: Any]?)
Generate a playback start event (first media frame).
| Param | Type | Description |
| cursorPosition | Int |
Current cursor position (ms) |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.playbackStart(
cursorPosition: 0,
extraProps: ["customProp": "customValue"]
)
Event name : av.stop
playbackStopped(cursorPosition: Int, extraProps: [String: Any]?)
Generate a stop event.
| Param | Type | Description |
| cursorPosition | Int |
Current cursor position (ms) |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.playbackStopped(
cursorPosition: 1000,
extraProps: ["customProp": "customValue"]
)
Event name : av.forward ou av.backward
seek(oldCursorPosition: Int, newCursorPosition: Int, extraProps: [String: Any]?)
Generate a seek event.
| Param | Type | Description |
| oldCursorPosition | Int |
Cursor position before seeking (ms) |
| newCursorPosition | Int |
Cursor position after seeking (ms) |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.seek(
oldCursorPosition: 1000,
newCursorPosition: 2000,
extraProps: ["customProp": "customValue"]
)
myMedia.seek(
oldCursorPosition: 2000,
newCursorPosition: 1000,
extraProps: ["customProp": "customValue"]
)
The following list of events is not taken into account in the calculation of media consumption times. They are one-time contextual events.
Event name : av.ad.click
adClick(extraProps: [String: Any]?)
Generate an ad click event.
| Param | Type | Description |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.adClick(
extraProps: ["customProp": "customValue"]
)
Event name : av.ad.skip
adSkip(extraProps: [String: Any]?)
Generate an ad skip event.
| Param | Type | Description |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.adSkip(
extraProps: ["customProp": "customValue"]
)
Event name : av.close
close(extraProps: [String: Any]?)
Measure a closing.
| Param | Type | Description |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.close(
extraProps: ["customProp": "customValue"]
)
Event name : av.display
display(extraProps: [String: Any]?)
Measure a display.
| Param | Type | Description |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.display(
extraProps: ["customProp": "customValue"]
)
Event name : av.buffer.start ou av.error
error(message: String, extraProps: [String: Any]?)
Measure an error preventing playback.
| Param | Type | Description |
| message | String |
Error message |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.error(
message: "Error loading video",
extraProps: ["customProp": "customValue"]
)
Event name : av.fullscreen.off
fullscreenOff(extraProps: [String: Any]?)
Measure full screen deactivation.
| Param | Type | Description |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.fullscreenOff(
extraProps: ["customProp": "customValue"]
)
Event name : av.fullscreen.on
fullscreenOn(extraProps: [String: Any]?)
Measure full screen activation.
| Param | Type | Description |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.fullscreenOn(
extraProps: ["customProp": "customValue"]
)
Event name : av.quality
quality(extraProps: [String: Any]?)
Measure a quality change.
| Param | Type | Description |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.quality(
extraProps: ["customProp": "customValue"]
)
Event name : av.share
share(extraProps: [String: Any]?)
Measure a sharing.
| Param | Type | Description |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.share(
extraProps: ["customProp": "customValue"]
)
Event name : av.speed
speed(extraProps: [String: Any]?)
Measure a speed change.
| Param | Type | Description |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.speed(
extraProps: ["customProp": "customValue"]
)
Event name : av.subtitle.off
subtitleOff(extraProps: [String: Any]?)
Measure subtitles deactivation
| Param | Type | Description |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.subtitleOff(
extraProps: ["customProp": "customValue"]
)
Event name : av.subtitle.on
subtitleOn(extraProps: [String: Any]?)
Measure subtitles activation.
| Param | Type | Description |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.subtitleOn(
extraProps: ["customProp": "customValue"]
)
Event name : av.volume
volume(extraProps: [String: Any]?)
Measure sound volume change.
| Param | Type | Description |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.volume(
extraProps: ["customProp": "customValue"]
)
The following events are automatically generated by the Tracker. You can, however, call up the associated public marking methods if you need spot marking.
Event name : av.buffer.heartbeat
bufferHeartbeat(extraProps: [String: Any]?)
Generate a buffering heartbeat before the playback starts event.
| Param | Type | Description |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.bufferHeartbeat(
extraProps: ["customProp": "customValue"]
)
Event name: av.heartbeat
heartbeat(cursorPosition: Int, extraProps: [String: Any]?)
Generate a heartbeat event.
| Param | Type | Description |
| cursorPosition | Int |
Current cursor position (ms) |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.heartbeat(
cursorPosition: 45,
extraProps: ["customProp": "customValue"]
);The cursor position is not required for tagging a
heartbeatevent. By forcing the parameter value to -1, the cursor position will be automatically calculated according to the context (playback speed factor, cursor position of the previous event).
Event name : av.rebuffer.heartbeat
rebufferHeartbeat(extraProps: [String: Any]?)
Generate a buffering heartbeat after the playback starts event.
| Param | Type | Description |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.rebufferHeartbeat(
extraProps: ["customProp": "customValue"]
)
Event name : av.backward
seekBackward(oldCursorPosition: Int, newCursorPosition: Int, extraProps: [String: Any]?)
Generate a backward seeking event.
| Param | Type | Description |
| oldCursorPosition | Int |
Cursor position before seeking (ms) |
| newCursorPosition | Int |
Cursor position after seeking (ms) |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.seekBackward(
oldCursorPosition: 2000,
newCursorPosition: 1000,
extraProps: ["customProp": "customValue"]
)
Event name : av.forward
seekForward(oldCursorPosition: Int, newCursorPosition: Int, extraProps: [String: Any]?)
Generate a forward seeking event.
| Param | Type | Description |
| oldCursorPosition | Int |
Position de la tête de lecture avant déplacement (ms) |
| newCursorPosition | Int |
Position de la tête de lecture après déplacement (ms) |
| extraProps | [String: Any]? |
Propriétés personnalisées |
Example
myMedia.seekForward(
oldCursorPosition: 1000,
newCursorPosition: 2000,
extraProps: ["customProp": "customValue"]
)
Event name : av.seek.start
seekStart(oldCursorPosition: Int, extraProps: [String: Any]?)
Generate a beginning of seeking event.
This event is automatically raised when calling the seek(), seekBackward() or seekForward() methods.
| Param | Type | Description |
| oldCursorPosition | Int |
Cursor position before seeking (ms) |
| extraProps | [String: Any]? |
Custom properties |
Example
myMedia.seekStart(
oldCursorPosition: 1000,
extraProps: ["customProp": "customValue"]
)
The AV Insights universal event tagging method allows standard or custom events to be tracked. This function can be used to replace calls to other event tagging methods (play, playbackStart, bufferStart, etc.).
Event name : event value
track(event: String, options: [String: Any]?, extraProps: [String: Any]?)
Track standard or custom actions.
| Param | Type | Description |
| event | String |
Event to be generated (see list of standard events at the bottom of the page) |
| options | [String: Any]? |
Options depending on the event (see list of available options at the bottom of the page) |
| extraProps | [String: Any]? |
Custom properties |
Example
let tracker = ATInternet.sharedInstance.defaultTracker
let myMedia = tracker.avInsights.Media(heartbeat: 5, bufferHeartbeat: 5)
// Buffer tagging
myMedia.track(event: "av.buffer.start", options: ["av_position": 0], extraProps: nil)
// Re-buffer tagging
myMedia.track(event: "av.rebuffer.start", options: ["av_position": 0], extraProps: nil)
// Play tagging
myMedia.track(event: "av.play", options: ["av_position": 0], extraProps: nil)
// Playback start tagging
myMedia.track(event: "av.start", options: ["av_position": 0], extraProps: nil)
// Playback pause tagging
myMedia.track(event: "av.pause", options: ["av_position": 10], extraProps: nil)
// Playback resume tagging
myMedia.track(event: "av.resume", options: ["av_position": 10], extraProps: nil)
// Playback stop tagging
myMedia.track(event: "av.stop", options: ["av_position": 20], extraProps: nil)
// Seek forward tagging
myMedia.track(event: "av.forward", options: ["av_previous_position": 10, "av_position": 20], extraProps: nil)
// Seek backward tagging
myMedia.track(event: "av.backward", options: ["av_previous_position": 20, "av_position": 10], extraProps: nil)
// Ad click tagging
myMedia.track(event: "av.ad.click", options: nil, extraProps: nil)
// Ad skip tagging
myMedia.track(event: "av.ad.skip", options: nil, extraProps: nil)
// Error tagging
myMedia.track(event: "av.error", options: ["av_player_error": "Player error"], extraProps: nil)
// Display tagging
myMedia.track(event: "av.display", options: nil, extraProps: nil)
// Close tagging
myMedia.track(event: "av.close", options: nil, extraProps: nil)
// Volume tagging
myMedia.track(event: "av.volume", options: nil, extraProps: nil)
// Subtitle on tagging
myMedia.track(event: "av.subtitle.on", options: nil, extraProps: nil)
// Subtitle off tagging
myMedia.track(event: "av.subtitle.off", options: nil, extraProps: nil)
// Full screen on tagging
myMedia.track(event: "av.fullscreen.on", options: nil, extraProps: nil)
// Full screen off tagging
myMedia.track(event: "av.fullscreen.off", options: nil, extraProps: nil)
// Quality tagging
myMedia.track(event: "av.quality", options: nil, extraProps: nil)
// Speed tagging
myMedia.track(event: "av.speed", options: nil, extraProps: nil)
// Share tagging
myMedia.track(event: "av.share", options: nil, extraProps: nil)
// Custom tagging
myMedia.track(event: "custom", options: nil, extraProps: ["customParam": "customValue"])
let tracker = ATInternet.sharedInstance.defaultTracker
let myMedia = tracker.avInsights.Media(heartbeat: 5, bufferHeartbeat: 5) // Set heartbeats value (5 seconds)
let properties: [String: Any] = [
"av_content_id": "fge234",
"av_content": "myContent",
"av_content_type": "Video",
"av_content_duration": 10000,
"av_content_genre": ["entertainment"],
"av_content_version": "short",
"av_player": "HTML5_V123",
"av_player_version": "1b",
"av_player_position": "top",
"av_broadcasting_type": "On Demand",
"av_publication_date": 1562055880,
"av_show": "The gist of the game",
"av_show_season": "Season 1",
"av_episode_id": "3134",
"av_channel": "INFO",
"av_author": "AT Internet",
"av_broadcaster": "Direction 123",
"av_language": "EN",
"av_subtitles": "FR",
"av_launch_reason": "Auto"
]
// Set media properties
myMedia.setProps(obj: properties)
// Play attempt (cursor position 0 second)
myMedia.play(cursorPosition: 0, extraProps: nil)
// Buffering before playback start (cursor position 0 second)
myMedia.bufferStart(cursorPosition: 0, extraProps: nil)
// Playback start (cursor position 0 second)
myMedia.playbackStart(cursorPosition: 0, extraProps: nil)
// Buffering after 5 seconds of playback
myMedia.bufferStart(cursorPosition: 5000, extraProps: nil)
// Seek action (backward from cursor position 5 seconds to cursor position 3 seconds)
myMedia.seek(oldCursorPosition: 5000, newCursorPosition: 3000, extraProps: nil)
// Playback resume (cursor position 3 seconds)
myMedia.playbackResumed(cursorPosition: 3000, extraProps: nil)
// Playback pause (cursor position 9 seconds)
myMedia.playbackPaused(cursorPosition: 9000, extraProps: nil)
// Playback resume (cursor position 9 seconds)
myMedia.playbackResumed(cursorPosition: 9000, extraProps: nil)
// Playback stop (cursor position 15 seconds)
myMedia.playbackStopped(cursorPosition: 15000, extraProps: nil)
| Property | Type | Description |
| av_player | String | Player identifier |
| av_player_version | String | Player version |
| av_player_position | String | Player position |
| av_content | String | Content label |
| av_content_id | String | Content identifier |
| av_content_type | String | Content type (Audio/Video/Gaming…) |
| av_content_duration | Int | Content duration (milliseconds) |
| av_content_version | String | Content version |
| av_content_genre | [String] | Content genre (news/entertainment…) |
| av_content_linked | String | Linked content |
| av_content_duration_range | String | Content duration range (‘0-10’…) |
| av_broadcasting_type | String | Broadcasting type (live, VOD) |
| av_ad_type | String | Ad type (Pre-roll/Mid-Roll/Post-Roll) |
| av_publication_date | Int | Publication date (secondes -format UTC) |
| av_show | String | Show label |
| av_show_season | String | Show season |
| av_episode_id | String | Episode identifier |
| av_episode | String | Episode label |
| av_channel | String | Channel |
| av_author | String | Author name |
| av_broadcaster | String | Broadcaster label |
| av_auto_mode | Bool | Is playback auto? |
| av_language | String | Media language |
| av_subtitles | String | Subtitles |
| av_launch_reason | String | Launch reason |
| Event |
| av.heartbeat |
| av.buffer.heartbeat |
| av.rebuffer.heartbeat |
| av.play |
| av.buffer.start |
| av.rebuffer.start |
| av.start |
| av.resume |
| av.pause |
| av.stop |
| av.forward |
| av.backward |
| av.seek.start |
| av.ad.click |
| av.ad.skip |
| av.error |
| av.display |
| av.close |
| av.volume |
| av.subtitle.on |
| av.subtitle.off |
| av.fullscreen.on |
| av.fullscreen.off |
| av.quality |
| av.speed |
| av.share |
| Option | Description |
| av_position | Current cursor position (ms) |
| av_previous_position | Previous cursor position (ms) |
| av_player_error | Error preventing playback |
Last update: 06/01/2021
-
Data API
- Data flow
- Advice optimizations data flow
- Error codes data flow
- Faq data flow
- General information data flow
- Technical information data flow
- Reporting API v3
- Getting started
- Methods
- Parameters
- Technical information
- REST API
- Campaigns
- Custom variables
- Getting started rest
- Methods rest
- Response structure parameters rest
- Fixed periods
- Parameters compatibility
- Relative periods
- Structure of the response
- “code” parameter
- “columns” parameter
- “evo” parameter
- “filter” parameter
- “include” parameter
- “lng” parameter
- “max-results” parameter
- “page-num” parameter
- “period” parameter
- “period” parameter: “H” v. “He” & “MN” v. “MNe”
- “retention” parameter
- “segmentdesc” parameter
- “segment” parameter
- “sep” parameter
- “sort” parameter
- “space” parameter
- Technical specifications rest
- Data flow
-
Data collection
- Android
- Advanced features
- Campaigns
- Changelog
- Content
- Ecommerce
- Getting started
- Users
- Apple
- Advanced features
- Campaigns
- Changelog
- Content
- Ecommerce
- Getting started
- Users
- General
- Cddc renew staging process
- Changelog
- Craft your hit
- Encoded parameters
- Server side cookie management
- Supported taggings
- Tagging deletion
- Utilisation of dispatch sdks
- JavaScript
- Advanced features
- Campaigns
- Changelog
- Content
- Ecommerce
- Getting started
- Partners javascript
- Users
- Piano Analytics
- Event tagging piano analytics
- Getting started piano analytics
- Piano analytics tagging
- Feeding piano analytics with as2 tagging
- Tagging custom properties sdk
- Android