Shopify设置cookiebot教程

cookiebot没有APP

https://admin.cookiebot.com/signup

免费版限制:

不超过50个页面【如果网站页面数量超过,就不建议使用免费版】

如果不满足升级为付费版:

https://www.cookiebot.com/en/pricing

添加教程:

主题-编辑代码

Snippets

cookie-consent

添加下面代码

<script>
function feedback() {
const p = window.Shopify.customerPrivacy;
console.log(`Tracking ${p.userCanBeTracked() ? “en” : “dis”}abled`);
}
window.Shopify.loadFeatures(
[
{
name: “consent-tracking-api”,
version: “0.1”,
},
],
function (error) {
if (error) throw error;
if (“Cookiebot” in window)
window.Shopify.customerPrivacy.setTrackingConsent({
“analytics”: false,
“marketing”: false,
“preferences”: false,
“sale_of_data”: false,
}, () => console.log(“Awaiting consent”)
);
}
);

window.addEventListener(“CookiebotOnConsentReady”, function () {
const C = Cookiebot.consent,
existConsentShopify = setInterval(function () {
if (window.Shopify.customerPrivacy) {
clearInterval(existConsentShopify);
window.Shopify.customerPrivacy.setTrackingConsent({
“analytics”: C[“statistics”],
“marketing”: C[“marketing”],
“preferences”: C[“preferences”],
“sale_of_data”: C[“marketing”],
}, () => console.log(“Consent captured”))
}
}, 100);
});
</script>

 

theme.liquid

<head>

下面增加:

<script
id=”Cookiebot”
src=”https://consent.cookiebot.com/uc.js”
data-cbid=”00000000-0000-0000-0000-000000000000″
type=”text/javascript”
defer
></script>

{{ content_for_header }}

下面增加:

{% render ‘cookie-consent’ %}



0
分享到: