Created
July 9, 2013 14:12
-
-
Save MaxPower15/5957653 to your computer and use it in GitHub Desktop.
Easily report email conversions for all Wistia embeds on a page.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
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