Welcome to the Swarmify developer hub. You'll find comprehensive guides and documentation to help you start working with Swarmify as quickly as possible, as well as support if you get stuck. Let's jump right in!

Documentation    Get Started

Analytics

Google Analytics

We currently work with Google's analytics.js. (Support for the new gtag.js method is being worked on.)

If you have Google Analytics set up, you don't have to do anything. Our code will automatically send all video events to GA for analysis.

By default in GA, the Event Category will be "Video", and the Event Actions will be video events like "start", "play", "pause", "seek", "resize", etc. The Event Labels will be based on the file name, e.g., "http://example.com/demo_video.mp4" will have have an Event Label of "demo_video".

Here's a STARTER Google Analytics report template you can easily click-to-add into your GA account. They are basic video stats showing:

  • Plays per day, by video
  • By device and OS
  • By Browser
  • by Country
  • Playback time by video (in seconds)
  • Completions per day, by video

You can customize around the metrics most useful to your project or business from there. Please let us know at [email protected] if there's any other stats you'd like to see here?

Options

If you want more control, you can configure the GA behavior in swarmoptions. The following settings are available:

  • eventCategory: defaults to 'Video'
  • eventLabel: defaults to the base of the video filename (caution: setting this will set it for all videos on the page)
  • eventsToTrack: defaults to ['loaded', 'percentsPlayed', 'start', 'end', 'seek', 'play', 'pause', 'resize', 'volumeChange', 'error', 'fullscreen']
  • debug: defaults to false
  • percentsPlayedInterval: defaults to 10

(Note: a percentsPlayed event is sent after every percentsPlayedInterval % of the video has been played. E.g., with the default percentsPlayedInterval of 10, a percentsPlayed will be sent after 10% of the video has been played, after 20%, after 30%, etc.)

To change these settings, add a ga key in the swarmoptions map, like so:

var swarmoptions = {
    swarmcdnkey: "<<publicAPIKey>>",
    ga: {
        debug: true,
        eventCategory: 'My Site Video',
        eventsToTrack: ['pause', 'seek', 'fullscreen'],
        percentsPlayedInterval: 20
    }
}

Updated 11 days ago

Analytics


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.