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>
PropertyDescription
triggers*Β objectConfiguration 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* objectObject containing basic amp-analytics component variables

See: vars


triggers.{eventTriggerName}

PropertyDescription
on* stringEvent for which to listen

Supported events:
Β Β Β β€’ video-ad-end
Β Β Β β€’ video-ad-start
Β Β Β β€’ video-ended
Β Β Β β€’ video-pause
Β Β Β β€’ video-percentage-played
Β Β Β β€’ video-play
Β Β Β β€’ video-session
request* stringName of the request to send

This should always be set to event.
selector*Β stringValid CSS selector used to select the amp-jwplayer component to track
vars* stringObject containing key-value pairs specific to this trigger

See: triggers.{eventTriggerName}.vars

triggers.{eventTriggerName}.vars

PropertyDescription
eventAction* stringName for the given event

To learn more about the eventAction property, read Event Management.
eventCategory*Β stringCategory for the given event

To learn more about the eventCategory property, read Event Management.

To learn more about the triggers object, read Triggers.



vars

PropertyDescription
account* string
Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β 
Identifier for the Google Analytics account to which video analytics are sent

To learn more about the vars object, read Vars.