Embed Code ID Tagging

Pass an ID for each viewer to your stats through the player API using these simple steps!

Using the Video Player API, you can create simple ID tagging that passes user info into your Wistia stats. Your two options for executing this is:

  1. using the wemail= URL query string
  2. a separate function using the trackEmail embed option.
📝

Note

The Wistia APIs were specifically built for videos in projects. We do not formally support using our APIs for audio files in projects, or audio or video episodes in Channels at this time. For the most reliable experience, we recommend continuing to use these for videos in projects.

URL Query String Approach

The custom query string URL approach produces a link like this:

http://[email protected]

If you have access to the user's email address (through log-in or form submittal, etc.) you can replace the example<span>@</span>mail.com string with this information.

📝

Note

The URL on the page where the video is embedded (and played from) must have the custom query string.

Identifying individual viewers from unique links

Using this method, you don't need a Wistia form to know who watched. If you can generate a unique link per recipient, such as an email campaign or a personalized landing page, you can tag each viewer's identity onto their link with wemail= and have that identity show up in your Wistia stats.

The value doesn't have to be a literal email address. If you'd rather not put a real email in a link, use any identifier you can map back to a person on your side, such as a CRM ID or a hashed value as shown below:

http://your-video-URL.com?wemail=contact-48217

In an email campaign, populate wemail= with your sending tool's recipient merge tag so each recipient gets their own tagged link automatically at scale. You can learn more about dynamic links here.

There's no per-link object created in Wistia, since you're only generating URLs on your own side, so there's no Wistia-side limit on how many unique links you produce.

A tagged viewer's identifier appears on the Audience and individual Viewer views in your video's stats, attached to their viewing session alongside play count, watch percentage, and engagement. This helps you answer "Did this specific recipient watch, and how much?" without a form gating the video.

🚧

Privacy Caveat

The wemail value travels in the URL and is stored in your Wistia stats, so anyone who sees the link sees the identifier. If the recipient may share or forward their link, use a non-PII token (such as a CRM ID or hashed value) instead of a real email address, and resolve it back to a specific person in your own system.


Email Embed Option

There is an embed option you can use to track the viewer's email when they watch the video. This process is predicated on there being a variable available on the client-side for tracking emails (ie. after they log in, their user info is tracked in a cookie).

You'll want to use the email embed option in your embed code.

This should be added to the wistia_embed class. Inside the embed code, this will look like the following:

<script src="https://fast.wistia.com/embed/medias/g9tdlp0rre.jsonp" async></script>
<script src="https://fast.wistia.com/assets/external/E-v1.js" async></script>
<div class="wistia_responsive_padding" style="padding:56.25% 0 0 0;position:relative;">
  <div class="wistia_responsive_wrapper" style="height:100%;left:0;position:absolute;top:0;width:100%;">
    <div class="wistia_embed wistia_async_g9tdlp0rre videoFoam=true email=userEmail" style="height:100%;position:relative;width:100%">
      <div class="wistia_swatch" style="height:100%;left:0;opacity:0;overflow:hidden;position:absolute;top:0;transition:opacity 200ms;width:100%;">
        <img src="https://fast.wistia.com/embed/medias/g9tdlp0rre/swatch" style="filter:blur(5px);height:100%;object-fit:contain;width:100%;" alt="" aria-hidden="true" onload="this.parentNode.style.opacity=1;" />
      </div>
    </div>
  </div>
</div>

The variable for the email address (userEmail) will need to be updated to reflect the variable of your identifiable user information.