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