To embed m2m session to a web page, you need to load our recorder library.

That’s a script and a stylesheet:

<link rel="stylesheet" href="https://workbench.mercuryanalytics.com/api/recorder.css">
<script src="https://workbench.mercuryanalytics.com/api/recorder.js"></script>

Then, you need to tell it where on the page to put the video.

<div data-hg-recorder="2160_PO_DEMO" data-hg-rid="000000"></div>

The “2160_PO_DEMO” is the unique id we give you for each video to be tested within a project, which changes with each project, and the “000000” should be replaced with the unique respondent id you assigned.

It’s safe to add the stylesheet and script to your survey’s template, since it does nothing when there’s no marker div to tell it where to put the video.

Options

Sizing the recorder

Controlling the size of the recorder can be a little bit complicated. By default, the recorder will attempt to size itself to be the full width of the browser window. If this results in a height that is too tall, it will shrink the video to fit in the window while preserving its aspect ratio.

You can adjust this behavior by setting an attribute called data-hg-scale. This parameter is passed as a percentage (e.g., data-hg-scale="80" for 80%), and indicates that the recorder should be sized to that percentage of the browser width (again, shrinking if this would not fit vertically).

By coordinating with our project team, you can choose to opt out of this behavior in favor of a “natural” sizing strategy. After requesting to opt-out of the default sizing, when you don’t pass the scale parameter, the recorder will size itself based on the page’s stylesheet, and the size can be directly adjusted in CSS. Customers who are comfortable with using CSS-based page layout may find this sizing more intuitive.

In this natural-sizing mode, the recorder sizes itself to the margins and adjusts its height to maintain the original aspect ratio of the presented video.

Events

Examining response data

The mercury:complete event includes a detail property that contains the following structure:

{
  response: {
    data: {
      sampleData: number[],
      clickData?: {
        button: number,
        time: number
      }[],
      samples: string,
      clicks?: string
    }
  }
}

Sending Demographic Variables

Demographic variables can be sent directly during the M2M excercise, or sent at a later point in the survey.

This page details sending demographics only later in the survey, but the marker div tag for the M2M video can also accept the data-hg-demographics property to reference a set of demographic values as described on that page, and will send the data as part of the exercise.