The Problem
In markets using a Cookie Management Platform (CMP), the Kickbite trackers (script.js and u.js) may only fire after a page refresh following cookie consent acceptance.
This means the first session is lost — including UTM parameters and referrer data — which directly impacts attribution accuracy.
Expected Behavior
When a user clicks "Accept" on the cookie banner, both Kickbite scripts should be injected immediately — without requiring a page reload. At the moment of acceptance, window.location.href still contains the original UTMs and document.referrer still holds the traffic source.
How to Fix It
The CMP or tag manager must listen for a consent-granted event and dynamically inject the Kickbite scripts in that callback. The exact implementation depends on the CMP in use:
OneTrust — Use the
OptanonWrappercallback and checkOnetrustActiveGroupsCookiebot — Listen for the
CookiebotOnAccepteventUsercentrics — Listen for the
UC_UI_CMP_EVENTeventGoogle Tag Manager — Trigger a tag on the
consent_updatecustom event
In all cases, the injection function should include a double-load guard to prevent the scripts from being loaded twice (once on accept, once on reload).
Technical Implementation
Use the following shared injection function. Replace the script URLs with your actual Kickbite script paths:
function injectKickbite() {
if (window.__kickbiteLoaded) return; // prevent double-load
window.__kickbiteLoaded = true; var scripts = [
'https://your-domain.com/script.js',
'https://your-domain.com/u.js'
]; scripts.forEach(function (src) {
var s = document.createElement('script');
s.src = src;
s.async = true;
document.head.appendChild(s);
});
}
CMP-specific examples:
OneTrust
function OptanonWrapper() {
if (OnetrustActiveGroups.includes('C0002')) {
injectKickbite();
}
}
Cookiebot
window.addEventListener('CookiebotOnAccept', function () {
if (Cookiebot.consent.statistics) {
injectKickbite();
}
});
Usercentrics
window.addEventListener('UC_UI_CMP_EVENT', function (e) {
if (e.detail && e.detail.type === 'ACCEPT_ALL') {
injectKickbite();
}
});
Google Tag Manager
Create a Custom Event trigger on consent_update, then fire a tag that calls injectKickbite().
How to Verify
Open the site in an incognito window
Open browser DevTools → Network tab
Click "Accept" on the cookie banner
Confirm that
script.jsandu.jsappear in the network requests immediately — without a page reloadCheck that the request URL or payload includes the original UTM parameters
