Tracking
Cookie Consent
HTML
<script>
window.SOCIALPROOF_COOKIE_CONSENT = {
analytics: false,
marketing: false,
functional: false
};
</script>If your website asks visitors for cookie consent (GDPR), tell Trustisto about it with the window.SOCIALPROOF_COOKIE_CONSENT object. Set it before the initialization snippet.
- when
window.SOCIALPROOF_COOKIE_CONSENTis not set, Trustisto loads as usual - when it is set, Trustisto loads only if
analytics,marketingandfunctionalare alltrue; otherwiseSP.init()stops: no visitor ID cookie is set, no event is sent and no campaign is shown
After the visitor accepts
HTML
<script>
window.SOCIALPROOF_COOKIE_CONSENT = {
analytics: true,
marketing: true,
functional: true
};
SP.init("WEBSITE_ID");
</script>Make sure to replace
WEBSITE_IDwith your Website ID.
When the visitor accepts cookies, update the object and call SP.init() again. The snippets called earlier on that page (e.g. productPage) were queued and are sent once the library is initialized.