WingifyGuides

How to Track Wistia Video Plays Using Wingify

Using Wingify, you can track the number of users who played the Wistia Video on your website. The end-to-end process for setting up Wistia video tracking involves the following steps:

  1. Create a custom conversion goal in Wingify.
  2. Adding code snippet to track the video plays.

#Create a Custom Conversion Goal in Wingify

  • Create a test and define a custom conversion goal to track.
  • Select the URL matches pattern 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 on the website. For this, we use a wildcard (*) to define the URL pattern so that the conversion will occur on every page of the website that contains the Wingify SmartCode.
  • On the last page of the test creation process, copy the custom conversion code generated for the goal.
  • Make a note of the goal ID highlighted in the screenshot. You will need it at a later stage.

#Adding Code Snippet to Track The Video Plays

To start tracking the video plays, execute the JS code shared below. This JS code can be placed via any preferred method:

  1. You can fire this code via GTM.

  2. If you are using the A/B test or Rollouts, this code can be placed inside the code editor. Place the code inside Variation-JS (if the video is available only inside Variation) or Pre-JS | Post-JS (if the video is available in both control & variation)

    • Accounts created before June 14, 2026
    • Accounts created on/after June 14, 2026
    <script type = 'text/javascript' >
        window.wistia_vwo_video_id = "Replace this with your Wistia Video ID that needs to be tracked";
    window.video_play_goal_id = "Replace this with your custom conversion goal ID";
    window._wq = window._wq || [];
    _wq.push({
        id: "_all",
        onReady: function(video) {
            console.log("Found Wistia Video Handle", video);
            wistiaEmbeds.bind("play", function(e) {
                if (e._hashedId == wistia_vwo_video_id) {
                    window._vis_opt_queue = window._vis_opt_queue || [];
                    window._vis_opt_queue.push(function() {
                        _vis_opt_goal_conversion(video_play_goal_id);
                    });
                    console.log("Video Play Tracked In VWO");
                }
            });
        }
    });
    </script>
    
    <script type = 'text/javascript' >
       window.wistia_vwo_video_id = "Replace this with your Wistia Video ID that needs to be tracked";
    window.video_play_event_name = "Replace this with your custom event name";
    window._wq = window._wq || [];
    _wq.push({
       id: "_all",
       onReady: function(video) {
           console.log("Found Wistia Video Handle", video);
           wistiaEmbeds.bind("play", function(e) {
               if (e._hashedId == wistia_vwo_video_id) {
                   window.Wingify = window.Wingify || [];
                   Wingify.event = VWO.event || function () {VWO.push(["event"].concat([].slice.call(arguments)))};
                   Wingify.event(window.video_play_event_name);
                   console.log("Video Play Tracked In VWO");
               }
           });
       }
    });
    </script>
    

To learn more, refer to our Video Heatmap blog.

#Need more help?

For further assistance or more information, contact Wingify Support.