Analytics Consent ​
Overview ​
Typically the Videobot built-in analytics are enabled by default, as they are fully anonymized and contain no user-identifiable data. However, because of regional difference or company policies, it might be prudent to disable them and only allow performance metrics when consent is given. This guides shows how to handle passing consent with common CMPs.
For the special case of HTML iframes, see the guide for handling iframe consent.
Implementation Summary ​
Built-in analytics can be enabled or disabled through the JavaScript based API.
When the Videobot script is loaded, it exposes an API in the window.Videobot
object. The relevant functions in this case are:
js
window.Videobot.enableAnalytics()
window.Videobot.disableAnalytics()
Integration with Google Tag Manager (GTM) ​
1. Create a Custom HTML Tag in GTM ​
html
<script>
document.addEventListener('consentUpdate', function() {
if ({{Analytics Cookie Consent}}) {
window.Videobot.enableAnalytics()
} else {
window.Videobot.disableAnalytics()
}
});
</script>
2. Set GTM Trigger ​
Configure the tag to trigger on:
- Page load (to set initial consent)
- Consent update events (when user changes preferences)
Integration with Common CMPs ​
OneTrust ​
javascript
function handleOneTrustConsent() {
// Wait for OneTrust to be ready
if (typeof OnetrustActiveGroups !== 'undefined') {
const activeGroups = OnetrustActiveGroups.split(',');
if (activeGroups.includes('C0003')) {
window.Videobot.enableAnalytics()
} else {
window.Videobot.disableAnalytics()
}
}
}
// Initial setup
document.addEventListener('DOMContentLoaded', handleOneTrustConsent);
// Handle consent changes
document.addEventListener('consent.onetrust', handleOneTrustConsent);
Cookiebot ​
javascript
window.addEventListener('CookiebotOnAccept', function() {
if (Cookiebot.consent.statistics) {
window.Videobot.enableAnalytics()
} else {
window.Videobot.disableAnalytics()
}
});
Troubleshooting ​
- Check browser console for security errors related to cross-origin communication
- Verify the Videobot script has loaded before using the JS API
- Confirm your CMP is correctly detecting and reporting consent categories