DP Cookie 同意书
这是一个小脚本,允许管理可选饼干的饼干同意.
使用量
import { dpConsent } from 'cookie-consent/dist/dp-consent.es.min.js'
// initializing dp consent
const consent = dpConsent({
notice: '', // text to be shown in the cookie slideout
optionalCookies: [
{
name: '', // the cookie's name
explanation: '' // what does this cookie do
},
{ ... }
], // an array of optional cookies
necessaryCookies: [ /* same structure as above */ ], // an array of necessary cookies
onGrantConsent: () => {}, // callback to be executed when consent is granted
onRevokeConsent: () => {} // callback to be executed when consent is revoked
})
// adjusting consent settings
consent.adjustSettings()
怎么样?
Dp- Cookie- Concord 将显示一个幻灯片输出, 提供接受所有 cookie 或更改 cookie 设置的选项 . 如果全部 cookie 被接受, 将会执行在 Grant Conservation 上调用, 并且可以设置所有可选 cookie . 如果用户选择更改 cookie 设置, 将会打开一个模式, 向用户提供所有必要的列表 和所有的可选饼干。 如果用户选择可选的 cookie 并保存这些设置, 则在 Grant Concess- callback 上 将被执行。 如果用户不选择可选的 cookie , 将会执行 Revoke 上的 Concess- callback 。 一个饼干会 设定可以记住用户的选择。 饼干在一年内就过期了.