Sklik and passing consent
Sklik requires the code to send it a consent parameter with the value 1 or 0 depending on the consent the visitor gave. This applies to both the retargeting and the conversion code. Below is our solution for both cases.
Retargeting code
The retargeting code runs on every page of the website. It must first run with the value consent: 0, and after consent is given it must run again with the value consent: 1.
Sklik run from the bar's dashboard
If you have Sklik inserted through our bar, replace its code with the blocks below. Always replace XXX with your ID.
In Necessary scripts, which always run, insert:
<script type="text/javascript" src="https://c.seznam.cz/js/rc.js"></script>
<script>
function cvd(v = '', cb = () => {}) {
var mto = 10000, cto = 0, f = 100,
idi = setInterval(() => {
if (typeof window[v] !== 'undefined') { cb(); clearInterval(idi) }
cto += f;
if (cto >= mto) { clearInterval(idi) }
}, f)
}
if (!cookieconsent.allowedCategory('marketing')) {
cvd('sznIVA', () => {
window.sznIVA.IS.updateIdentities({ eid: null });
var retargetingConf = {
rtgId: XXX,
consent: 0
};
window.rc.retargetingHit(retargetingConf);
})
}
</script>In Marketing scripts, which run only after consent, insert:
<script>
cvd('sznIVA', () => {
window.sznIVA.IS.updateIdentities({ eid: null });
var retargetingConf = {
rtgId: XXX,
consent: 1
};
window.rc.retargetingHit(retargetingConf);
})
</script>Sklik run from GTM
In Google Tag Manager, use the official Sklik template. Fill in your ID and set which consent type should control the tag. The template then takes care of the correct consent value itself.
Conversion code
The conversion code is inserted only on pages where you measure a conversion, typically the thank-you page.
Code inserted directly in the website
First insert a function that reads the consent cookie into the page head. If you cannot insert it into the head, it must at least be above the conversion script.
const hasCSCookie = (type) => {
const ccCookie = document.cookie
.split(";")
.map(str => str.trim().split(/=(.+)/))
.reduce((acc, curr) => { acc[curr[0]] = curr[1]; return acc; }, {})
.cc_cookie;
return !ccCookie ? 0 : (JSON.parse(ccCookie).level.includes(type) ? 1 : 0);
}Then adjust the conversion script itself:
<script type="text/javascript" src="https://c.seznam.cz/js/rc.js"></script>
<script>
var conversionConf = {
id: XXX,
value: null,
consent: hasCSCookie('marketing')
};
if (window.rc && window.rc.conversionHit) {
window.rc.conversionHit(conversionConf);
}
</script>Code inserted through GTM
Again, the simplest way is to use the Sklik template, fill in the details and set which consent controls the tag. In addition, set the right trigger, for example the thank-you page being displayed after a purchase is completed.
Consent is stored in the first-party cookie cc_cookie. The cookieconsent.allowedCategory() function and the cc_cookie cookie are only available on pages where the Cookies správně bar runs.