Capturing Emails Through URL Paramater

There are a lot of different use cases for why you may want to capture an email from the URL parameter as a lead in vooPlayer.

If you are able to forward an email to the URL of the page on which you have a vooPlayer with an  Opt-in Lock, you can send that email directly to the vooPlayer opt-in, using the vooPlayer JavaScript API. Here's how you accomplish that.

Setting up your Opt-in lock

All you need to do is  add any opt-in lock to the video which you will embed on the page where the email parameter will be available.

Setting up your page

After you've made sure that the email parameter is available in the URL, you will add the following code below your vooPlayer embed code.

All you need to do after that is to replace the myId = "YOUR_VIDEO_ID_HERE";

<script> var myId='MjI1Mw==';
var domainRef = (window.location != window.parent.location) ? document.referrer : document.location.href;
var regex = /[?&]([^=#]+)=([^&#]*)/g,
    url = domainRef,
    params = {},
    match;
while(match = regex.exec(url)) {
    params[match[1]] = match[2];
}
document.addEventListener('vooPlayerReady', vooPlayerReadyFunction, false);
function vooPlayerReadyFunction(event){
  if(event.detail==myId && params.email){
vooAPI(myId, 'completeOptin', [params.email, true]);
}}</script>

Auto-complete or pre-fill?

The code above makes sure that the opt-in is auto-completed and never shown to the user, by passing the parameter true together with the email

You may change the last parameter in the vooAPI function to false which will simply pre-fill the optin with the captured email, so that way the opt-in will be shown, but the user will still have to confirm opting in.

Still need help? Contact Us Contact Us