Using VWO, you can track number of plays, pause, and rewind of Wistia videos in your website. The end-to-end process for setting up Wistia video tracking involves the following steps:
- Create a custom conversion goal in VWO.
- Add VWO custom conversion code snippet to the Wistia script.
Create a Custom Conversion Goal in VWO
- Create a test and define a custom conversion goal to track.
- Select URL matches and enter the URL pattern for the pages where the videos are hosted.
- Normally, the custom conversion triggers on a specific page – a thank-you page or something similar. However, in our case, we want the goal to trigger conversion everywhere the Wistia video appears in the website. For this, we use a wildcard (*) to define URL pattern so that the conversion will occur on every page of the website that contains the VWO smart code.
- On the last page of the test creation process, copy the custom conversion code generated for the goal.
- Make note of the goal ID highlighted in the screenshot. You will need it at a later stage.
Add VWO Custom Conversion Code Snippet to the Wistia Script
Add the VWO custom conversion goal code just below the Wistia code on all your test pages. Please note that the custom conversion code is added in addition to VWO smart code while it is already present in all your test pages.
Use the following code:
wistiaEmbed = this.wistiaApi;
else if ($(this).is('div'))
var searchPattern = new RegExp("wistia_(.+)");
var matches = $(this).attr('id').match(searchPattern);
wistiaId = matches;
wistiaEmbed = Wistia.embed(wistiaId);
if(wistiaEmbed.hashedId() == '1le4bjrj8h')
wistiaEmbed.bind('conversion', function(type, value)
if(type == 'pre-roll-email')
//Execute Custom conversion goal