Skip to main content

Change The CTA URL

Currently, player supports passing only utm_ get-params into your CTA URL.
This guide shows how to modify the Call-to-Action (CTA) URL (add extra get-params) via custom settings.

You'd need to modify your embed code to make it look like this:

  1. Create the new variable holding CTA URL overrides
  2. Pass variable to the method run() in the embed code. Assuming that your variable is named vidalyticsCustomSettings, it should be t.run(a, vidalyticsCustomSettings) instead of t.run(a):
<script>
// Get URL parameters from the current page
function getQueryParam(param) {
return new URLSearchParams(window.location.search).get(param);
}

// Configure your target URL and parameters
const baseUrl = 'https://www.w3schools.com/html/tryit.asp'; // Change this to your target URL
const extra_params = ['email', 'sub', 'lead']; // Add extra parameters you want to pass

const url = new URL(baseUrl);

extra_params.forEach(param => {
const value = getQueryParam(param);
if (value) {
url.searchParams.set(param, value);
}
});

var vidalyticsCustomSettings = {
tweak: {
callToActions: {
link: {
href: url.toString()
}
}
}
};
</script>

<div id="vidalytics_embed_[EMBED_ID]" style="width: 100%; position:relative; padding-top: 56.25%;"></div>
<script>
(function (v, i, d, a, l, y, t, c, s) {
y='_'+d.toLowerCase();c=d+'L';if(!v[d]){v[d]={};}if(!v[c]){v[c]={};}if(!v[y]){v[y]={};}var vl='Loader',vli=v[y][vl],vsl=v[c][vl + 'Script'],vlf=v[c][vl + 'Loaded'],ve='Embed';
if (!vsl){vsl=function(u,cb){
if(t){cb();return;}s=i.createElement("script");s.type="text/javascript";s.async=1;s.src=u;
if(s.readyState){s.onreadystatechange=function(){if(s.readyState==="loaded"||s.readyState=="complete"){s.onreadystatechange=null;vlf=1;cb();}};}else{s.onload=function(){vlf=1;cb();};}
i.getElementsByTagName("head")[0].appendChild(s);
};}
vsl(l+'loader.min.js',function(){if(!vli){var vlc=v[c][vl];vli=new vlc();}vli.loadScript(l+'player.min.js',function(){var vec=v[d][ve];t=new vec();t.run(a, vidalyticsCustomSettings);});});
})(window, document, 'Vidalytics', 'vidalytics_embed_[EMBED_ID]', 'https://quick.vidalytics.com/embeds/[USER_ID]/[EMBED_ID]/');
</script>