Track video AMP embed analytics (Web Player)
Learn how to track video analytics and include the data in your Google Analytics data.
After embedding adding the amp-jwplayer component to a Google AMP page, you can track the user interaction with your video or audio content.
On your AMP page, add an amp-analytics component after the amp-jwplayer component.
<amp-analytics type="googleanalytics" data-credentials="include">
<script type="application/json">
{
"vars": {
"account": "{google_analytics_id}"
},
"triggers": {
"eventTriggerName": {
"on": "video-play",
"request": "event",
"selector": "#myVideo",
"vars": {
"eventCategory": "video-events",
"eventAction": "video-play"
}
}
}
}
</script>
</amp-analytics>
Property | Description |
---|---|
triggers*Β object | Configuration object that contains child objects that describe event triggers. Each child object represents a single event trigger that describes when analytics requests should be sent. To identify an event trigger in your analytics, name each event trigger object. The event trigger object name can be any string comprised of alphanumeric characters (a-zA-Z0-9). See: triggers.{eventTriggerName} |
vars* object | Object containing basic amp-analytics component variables See: vars |
triggers.{eventTriggerName}
Property | Description |
---|---|
on* string | Event for which to listen Supported events: Β Β Β β’ video-ad-end Β Β Β β’ video-ad-start Β Β Β β’ video-ended Β Β Β β’ video-pause Β Β Β β’ video-percentage-played Β Β Β β’ video-play Β Β Β β’ video-session |
request* string | Name of the request to send This should always be set to event . |
selector*Β string | Valid CSS selector used to select the amp-jwplayer component to track |
vars* string | Object containing key-value pairs specific to this trigger See: triggers.{eventTriggerName}.vars |
triggers.{eventTriggerName}.vars
Property | Description |
---|---|
eventAction* string | Name for the given event To learn more about the eventAction property, read Event Management. |
eventCategory*Β string | Category for the given event To learn more about the eventCategory property, read Event Management. |
To learn more about the triggers
object, read Triggers.
vars
Property | Description |
---|---|
account* string Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β | Identifier for the Google Analytics account to which video analytics are sent |
To learn more about the vars
object, read Vars.
Updated about 1 year ago