Wistia

to the tippy ↑

Embed Code ID Tagging

Warning: You are heading into developer territory!

Our APIs are designed for programmers. If our APIs were a ski trail, they'd be a nice blue cruiser - anyone can do it, but expect to fall a few times if you don't know what you're doing!

If you're new to web development, we recommend taking a lesson before you hit our slopes. Try a class from Frontend Masters or Skillshare!

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.

URL Query String Approach

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

http://your-video-URL.com?wemail=example@mail.com

If you have access to the user's email address (through log-in or form submittal, etc.) you can replace the example@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.


Function with trackEmail Embed option

The new Wistia API embeds includes an option 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).

Note

You will need to use the 'API' version of the embed code to utilize this feature

Inside the embed code, you will see a snippet that appears like this:

playlist_api.js
1
2
3
4
5
6
7
8
<script type="text/javascript">
  var wistiaEmbed = Wistia.embed("bfc34aa023", {
    playerPreference: "html5",
    autoPlay: true,
    wmode: "transparent",
    container: "my_container"
  });
</script>

We will be adding the trackEmail embed option:

playlist_api.js
1
2
3
4
5
6
7
8
9
<script type="text/javascript">
  var wistiaEmbed = Wistia.embed("bfc34aa023", {
    playerPreference: "html5",
    autoPlay: true,
    wmode: "transparent",
    container: "my_container",
    trackEmail: "userEmail"
  });
</script>

The variables for Wistia video hashed ID (bfc34aa023) and email address (UserEmail) need to be updated to reflect your embedded video ID and the variable of your identifiable user information.