This is how to track video views with Wistia

Anonymous
Not applicable

This is how to track video views with Wistia

Hello Community! 

We use MKTO landing pages and tokens pretty heavily and the need came up to start writing the Lead Id to Wistia to identify video watches by Id.  

We had a problem with our normal way of doing this because the token was getting encoded and wasn't merging correctly.  

Here is some code that will work within a Marketo Landing page.  (We also tokenize the Wistia Video Id)

       <div id="wemail" class="hidden">{{lead.id}}</div>
        <div id="wistia_{{my.videoAssetWistiaId}}" class="wistia_embed" style="width:600px;height:338px; border: solid black 1px;">&nbsp;</div>
                  
           <script charset="ISO-8859-1" src="//fast.wistia.com/assets/external/E-v1.js"></script>
            <script>
                     var unencoded = document.getElementById("wemail").innerText;
 
                      wistiaEmbed = Wistia.embed("{{my.videoAssetWistiaId}}", {
                      videoFoam: true,
                      trackEmail: unencoded
                      });
                    </script>

You can also track video views within Marketo using the Munchkin API.  The code below will fire a page view in Marketo when the video is played. 

<div id="wistia_{{my.videoAssetWistiaId}}" class="wistia_embed" style="width:600px;height:338px;"> </div>
<script charset="ISO-8859-1" src="//fast.wistia.com/assets/external/E-v1.js"></script>
<script>
wistiaEmbed = Wistia.embed("{{my.videoAssetWistiaId}}", {
videoFoam: true
});

wistiaEmbed.bind('play', function() {
// Insert code to be executed here

mktoMunchkinFunction("visitWebPage",{ url: "/vpv/video/watch/explainer", params: "action=play"});
return this.unbind;

});

</script> 

We then setup interesting moments to fire when someone visits a page containing : /vpv/video/watch 

Hope it helps!
Tags (1)
7 REPLIES 7
Anonymous
Not applicable

Re: This is how to track video views with Wistia

Thanks for sharing this.

Would you be interested in turning this into a guest blog post for the Marketo developer blog? 

http://developers.marketo.com/blog/

Anonymous
Not applicable

Re: This is how to track video views with Wistia

Hi Murtza, 

I'd love to turn this into a blog post with fancy screenshots and everything!   Can you see my email address and reach out or reply with your email?

thx!
Anonymous
Not applicable

Re: This is how to track video views with Wistia

Mark - Great! Just sent you an email. 
Anonymous
Not applicable

Re: This is how to track video views with Wistia

Was this post ever published? Would love to see the full tutorial.
Anonymous
Not applicable

Re: This is how to track video views with Wistia

@Danielle. I wrote a post on a similar topic. How to send YouTube view data to Marketo:
http://developers.marketo.com/blog/send-view-data-from-a-youtube-video-to-marketo/
Anonymous
Not applicable

Re: This is how to track video views with Wistia

Murtza's post on YouTube video integration, along with the Wistia API documentation, was integral in getting us up-and-running with this. I'm not a javascript developer, but the usage is really not too hard. Here's the redacted code we used that appears to work (you need to replace everything between the plus signs, including the plus signs, with the Wistia video ID). We decided to only create two statuses in our video programs: started and finished. 

<script charset="ISO-8859-1" src="//fast.wistia.com/assets/external/E-v1.js"></script>
<script>
wistiaEmbed = Wistia.embed("+INSERT WISTIA VIDEO ID HERE+");
wistiaEmbed.bind
('play',function()
{
Munchkin.munchkinFunction('visitWebPage', {
url:'/video/+INSERT WISTIA VIDEO ID HERE+', params: 'video=started'})
}
);
wistiaEmbed.bind
('end',function()
{
Munchkin.munchkinFunction('visitWebPage', {
url:'/video/+INSERT WISTIA VIDEO ID HERE+', params: 'video=finished'})
}
)
</script>

We'd like to have one that tracks whether or not someone clicks the "call-to-action" link that appears at the end of the Wistia video, but I'm not sure that's part of the Wistia API - still investigating this. It appears as if Wistia will also send on "conversions" - which appears to mean that you can have gated videos, and that you can pass along the first name, last name, and email address via the API. Not sure if this can be used to insert new leads into Marketo, if the lead doesn't already exist...another thing we'd like to investigate.
Anonymous
Not applicable

Re: This is how to track video views with Wistia

@Matt, Thanks for the feedback!