Skip to main content

Adding Lazy Load to Your Videos

To add a lazy load to your videos, you will need to follow the steps below.

note

DON'T forget to change [EMBED_ID] and [USER_ID] with the appropriate details that you can find in your embed code.

note

If you want to add a lazy load code to your ClickFunnels page, you will need to add two custom JS/HTML code elements and put the longer code in the first one and shorter code in the second one.

Paste this code where the embed code of the video should be pasted (video element, custom JS/HTML code element):

<div id="vidalytics_embed_[EMBED_ID]" style="width: 100%; position:relative; padding-top: 56.25%;"></div>

Paste this code after the opening <body> tag:

<script>
function loadVidalyticsEmbedCode() {
setTimeout(doLoadVidalyticsEmbedCode, 500);
}

function doLoadVidalyticsEmbedCode() {
(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);});});
})(window, document, 'Vidalytics', 'vidalytics_embed_[EMBED_ID]', 'https://fast.vidalytics.com/embeds/[USER_ID]/[EMBED_ID]/');
}

if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', loadVidalyticsEmbedCode);
} else {
loadVidalyticsEmbedCode();
}
</script>