只是另一个cookie同意插件,使您的网站符合欧盟cookie法和GDPR。
该插件使用Bootstrap 5框架显示隐私设置模式弹出窗口,通知用户您的网站如何收集/使用他们的隐私数据,并允许他们接受/拒绝特定的cookie,如营销、偏好、分析。
1.在文档中加载所需的jQuery库和Bootstrap框架。
<link rel="stylesheet" href="/path/to/cdn/bootstrap.min.css" /> <script src="/path/to/cdn/jquery.min.js"></script> <script src="/path/to/cdn/bootstrap.min.js"></script>
2.加载引导程序-登录-设置.js
jQuery之后的脚本。
<script src="src/bootstrap-cookie-consent-settings.js"></script>
3.初始化插件并完成。
var cookieSettings = new BootstrapCookieConsentSettings()
4.编辑下的语言文件cookie同意内容
文件夹
// en.json { "title": "Privacy Settings", "body": "We use cookies and similar technologies that are necessary to operate the website. Additional cookies are only used with your consent. We use the additional cookies to perform analyses of website usage and to check marketing measures for their efficiency. These analyses are carried out to provide you with a better user experience on the website. You are free to give, deny, or withdraw your consent at any time by using the \"cookie settings\" link at the bottom of each page. You can consent to our use of cookies by clicking \"Agree\". For more information about what information is collected and how it is shared with our partners, please read our --privacy-policy--.", "privacyPolicy": "Data Protection Statement", "legalNotice": "Legal Notice", "mySettings": "My Settings", "buttonNotAgree": "I do not agree", "buttonAgree": "Agree", "buttonSaveSelection": "Save selection", "buttonAgreeAll": "Agree to all", "categories": { "necessary": { "title": "Necessary", "description": ["Required to run the website<"] }, "statistics": { "title": "Statistics", "description": ["Monitoring website usage and optimizing the user experience"] }, "marketing": { "title": "Marketing", "description": ["Evaluation of marketing actions"] }, "personalization": { "title": "Personalization", "description": ["Storage of your preferences from previous visits", "Collecting user feedback to improve our website", "Recording of your interests in order to provide customised content and offers"] } } }
5.确定是否在页面加载时显示Cookie同意设置模式。默认值:true。
var cookieSettings = new BootstrapCookieConsentSettings({ autoShowModal: false })
6.更多配置选项。
var cookieSettings = new BootstrapCookieConsentSettings({ // path to privacy policy page privacyPolicyUrl: undefined, // the URL of your privacy policy page // path to legal notice page legalNoticeUrl: undefined, // the language, in which the modal is shown lang: navigator.language, // supported languages (in ./cookie-consent-content/) defaultLang: "en", // dialog content contentURL: "/cookie-consent-content", // path to language files cookieName: "cookie-consent-settings", // cookie name cookieName: "cookie-consent-settings", // 365 days cookieStorageDays: 365, // modal ID modalId: "bootstrapCookieConsentSettingsModal", // categories categories: ["necessary", "statistics", "marketing", "personalization"] // callback function, called after the user has made his selection postSelectionCallback: undefined, // CSS classes buttonAgreeClass: "btn btn-primary", buttonDontAgreeClass: "btn btn-link text-decoration-none", buttonSaveClass: "btn btn-secondary", })
7.手动显示Cookie同意设置模式。
cookieSettings.showDialog();
8.获取cookie设置。
// get all cookieSettings.getSettings(); // get a specific setting cookieSettings.getSettings("analyses");
版本3.0.8(2022-06-18)
版本3.0.7(2022-06-15)
v2.1.1版本(2022-02-20)
2.0.1版(2021-11-23)
2.0.0版(2021-08-26)
v1.1.2 (2021-06-03)
Â