Skip to main content

How to Disable Cookie Usage

The Vidalytics player provides three methods to disable cookies:

1. Page-Level Disabling

You can disable cookies for the entire page by setting window._vidalytics.disableCookie to true.

When to use:

  • If you don’t use cross-domain tracking and your funnel doesn’t involve subdomain jumps (e.g., from example.com to buy.example.com).
  • If you have multiple videos on a page and want to disable cookies for each of them.

Implementation:

<script>
if (!window._vidalytics) window._vidalytics = {};
window._vidalytics.disableCookie = true;
</script>

2. Video-Level Disabling

To disable cookies on a per-video basis, modify your embed code as follows:

  1. Create a variable to hold the cookie settings: { tweak: { disableCookie: true } }
  2. Pass this variable to the run() method in the embed code. If the variable is named vidalyticsCustomSettings, replace t.run(a) with t.run(a, vidalyticsCustomSettings).

Example:

<script type="text/javascript">
var vidalyticsCustomSettings = {
tweak: {
disableCookie: true
}
};
</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>

3. Using the API Method

You can also control cookies programmatically using the window._vidalytics.tracking.setCookiePreference() method.

Key Features:

  • This method can be called at any time.
  • If set to false, it removes any previously stored Vidalytics cookies.
  • The preference is stored in Local Storage for persistence.
  • If called before the Vidalytics script loads, it retries execution automatically.

Implementation:

<script>
function setVidalyticsCookiePreference(isAllowed) {
const setCookiePreference =
window._vidalytics &&
window._vidalytics.tracking &&
window._vidalytics.tracking.setCookiePreference;

if (typeof setCookiePreference === 'function') {
setCookiePreference(isAllowed);
} else {
setTimeout(() => setVidalyticsCookiePreference(isAllowed), 100);
}
}

// Example Usage:
setVidalyticsCookiePreference(false); // Disables cookies
setVidalyticsCookiePreference(true); // Enables cookies (default behavior)
</script>

By choosing the appropriate method, you can effectively manage cookies based on your specific requirements.