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.



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.



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

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;" />

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