Skip to content

Instantly share code, notes, and snippets.

@MaxPower15
Created July 9, 2013 14:12
Show Gist options
  • Save MaxPower15/5957653 to your computer and use it in GitHub Desktop.
Save MaxPower15/5957653 to your computer and use it in GitHub Desktop.
Easily report email conversions for all Wistia embeds on a page.
<!--
For full control, the embed shepherd can be dynamically loaded from another script, and the inline script executed
after it's loaded.
-->
<script src="http://fast.wistia.com/static/embed_shepherd-v1.js"></script>
<script>
wistiaEmbeds.onFind(function(video) {
video.bind("conversion", function(type, email) {
if (/(pre|mid|post)-roll/.test(type)) {
// Using jsonp is a simple way to allow cross-domain data sharing
Wistia.jsonp.get("http://the-server-endpoint.com/that/receives/emails.json", {
video_id: video.hashedId(),
video_name: video.name(),
email: email
}, function(json) {
// this isn't required, just showing that you can do stuff with the response
console.log(json);
})
}
})
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment