analytics.js Vimeo Plugin

With the analytics.js Vimeo Plugin you can quickly get started collecting Vimeo player events into the Segment ecosystem.

Getting Started

1. Install

The plugin is distributed as both an NPM package and as a direct export via CDN.

CDN:

Simply add the following script tag to the head of your site, VimeoAnalytics will then be available as part of the global window.analyticsPlugins object.

<script src="https://cdn.jsdelivr.net/npm/@segment/vimeo-analytics@1.1.2/dist/vimeo.js"></script>

NPM:

# latest stable
$ npm install @segment/vimeo-analytics

2. Initialize

To initialize the plugin you will need to give it access to the Vimeo video player instance(s) running on your page. This is done using the initialize method:

<iframe src="https://player.vimeo.com/video/76979871" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<script src="https://player.vimeo.com/api/player.js"></script>
<script>
    var iframe = document.querySelector('iframe');
    var player = new Vimeo.Player(iframe);
    var VimeoAnalytics = window.analyticsPlugins.VimeoAnalytics  
    var vimeoAnalytics = new VimeoAnalytics(player)
    vimeoAnalytics.initialize()
</script>

That’s it! The plugin will now begin listening to the Vimeo player for events and respond by firing the corresponding Segment Video Spec events on analytics.js.

Supported Events

The following Segment Video Spec events are tracked by this plugin:

  • Video Playback Started
  • Video Playback Completed
  • Video Playback Paused/Resumed
  • Video Content Started/Completed

Supported Properties

The following Segment Video Spec properties are automatically attached to the above events:

‘Playback’ Events

  • Total Length
  • Position
  • Video Player
  • Sound

‘Content’ Events

  • Title
  • Description
  • Publisher

If you have any questions or see anywhere we can improve our documentation, please let us know or kick off a conversation in the Segment Community!