first commit
This commit is contained in:
11
config_uk.xml
Normal file
11
config_uk.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>cookiesconsent</name>
|
||||
<displayName><![CDATA[cookiesconsent]]></displayName>
|
||||
<version><![CDATA[0.1.1]]></version>
|
||||
<description><![CDATA[Help your customers cookiesconsent.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
<is_configurable>0</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
</module>
|
||||
360
cookieconsent-config.js
Normal file
360
cookieconsent-config.js
Normal file
@@ -0,0 +1,360 @@
|
||||
// cookieconsent-config.js
|
||||
|
||||
import * as CookieConsent from 'https://cdn.jsdelivr.net/gh/orestbida/cookieconsent@3.0.1/dist/cookieconsent.esm.js';
|
||||
|
||||
const CAT_NECESSARY = "necessary";
|
||||
const CAT_ANALYTICS = "analytics";
|
||||
const CAT_ADVERTISEMENT = "advertisement";
|
||||
const CAT_FUNCTIONALITY = "functionality";
|
||||
const CAT_SECURITY = "security";
|
||||
|
||||
const SERVICE_AD_STORAGE = 'ad_storage'
|
||||
const SERVICE_AD_USER_DATA = 'ad_user_data'
|
||||
const SERVICE_AD_PERSONALIZATION = 'ad_personalization'
|
||||
const SERVICE_ANALYTICS_STORAGE = 'analytics_storage'
|
||||
const SERVICE_FUNCTIONALITY_STORAGE = 'functionality_storage'
|
||||
const SERVICE_PERSONALIZATION_STORAGE = 'personalization_storage'
|
||||
const SERVICE_SECURITY_STORAGE = 'security_storage'
|
||||
|
||||
// Define dataLayer and the gtag function.
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag() { dataLayer.push(arguments); }
|
||||
|
||||
// Set default consent to 'denied' (this should happen before changing any other dataLayer)
|
||||
gtag('consent', 'default', {
|
||||
[SERVICE_AD_STORAGE]: 'denied',
|
||||
[SERVICE_AD_USER_DATA]: 'denied',
|
||||
[SERVICE_AD_PERSONALIZATION]: 'denied',
|
||||
[SERVICE_ANALYTICS_STORAGE]: 'denied',
|
||||
[SERVICE_FUNCTIONALITY_STORAGE]: 'denied',
|
||||
[SERVICE_PERSONALIZATION_STORAGE]: 'denied',
|
||||
[SERVICE_SECURITY_STORAGE]: 'denied',
|
||||
});
|
||||
|
||||
/**
|
||||
* Update gtag consent according to the users choices made in CookieConsent UI
|
||||
*/
|
||||
function updateGtagConsent() {
|
||||
console.log('updateGtagConsent');
|
||||
|
||||
const analyticsConsent = CookieConsent.acceptedService(SERVICE_ANALYTICS_STORAGE, CAT_ANALYTICS) ? 'granted' : 'denied';
|
||||
const adConsent = CookieConsent.acceptedService(SERVICE_AD_STORAGE, CAT_ADVERTISEMENT) ? 'granted' : 'denied';
|
||||
gtag('consent', 'update', {
|
||||
[SERVICE_ANALYTICS_STORAGE]: CookieConsent.acceptedService(SERVICE_ANALYTICS_STORAGE, CAT_ANALYTICS) ? 'granted' : 'denied',
|
||||
[SERVICE_AD_STORAGE]: CookieConsent.acceptedService(SERVICE_AD_STORAGE, CAT_ADVERTISEMENT) ? 'granted' : 'denied',
|
||||
[SERVICE_AD_USER_DATA]: CookieConsent.acceptedService(SERVICE_AD_USER_DATA, CAT_ADVERTISEMENT) ? 'granted' : 'denied',
|
||||
[SERVICE_AD_PERSONALIZATION]: CookieConsent.acceptedService(SERVICE_AD_PERSONALIZATION, CAT_ADVERTISEMENT) ? 'granted' : 'denied',
|
||||
[SERVICE_FUNCTIONALITY_STORAGE]: CookieConsent.acceptedService(SERVICE_FUNCTIONALITY_STORAGE, CAT_FUNCTIONALITY) ? 'granted' : 'denied',
|
||||
[SERVICE_PERSONALIZATION_STORAGE]: CookieConsent.acceptedService(SERVICE_PERSONALIZATION_STORAGE, CAT_FUNCTIONALITY) ? 'granted' : 'denied',
|
||||
[SERVICE_SECURITY_STORAGE]: CookieConsent.acceptedService(SERVICE_SECURITY_STORAGE, CAT_SECURITY) ? 'granted' : 'denied',
|
||||
});
|
||||
if (typeof window.clarity === 'function') {
|
||||
window.clarity('consentv2', {
|
||||
ad_Storage: adConsent,
|
||||
analytics_Storage: analyticsConsent,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
CookieConsent.run({
|
||||
// See: https://cookieconsent.orestbida.com/reference/configuration-reference.html#guioptions
|
||||
// ...
|
||||
|
||||
// Trigger consent update when user choices change
|
||||
onFirstConsent: () => {
|
||||
updateGtagConsent();
|
||||
},
|
||||
onConsent: () => {
|
||||
updateGtagConsent();
|
||||
},
|
||||
onChange: () => {
|
||||
updateGtagConsent();
|
||||
},
|
||||
|
||||
// Configure categories and services
|
||||
categories: {
|
||||
[CAT_NECESSARY]: {
|
||||
enabled: true, // this category is enabled by default
|
||||
readOnly: true, // this category cannot be disabled
|
||||
},
|
||||
[CAT_FUNCTIONALITY]: {
|
||||
enabled: true,
|
||||
services: {
|
||||
[SERVICE_FUNCTIONALITY_STORAGE]: {
|
||||
label: 'Enables storage that supports the functionality of the website or app e.g. language settings.',
|
||||
},
|
||||
[SERVICE_PERSONALIZATION_STORAGE]: {
|
||||
label: 'Enables storage related to personalization e.g. video recommendations.',
|
||||
},
|
||||
}
|
||||
},
|
||||
[CAT_ANALYTICS]: {
|
||||
enabled: true,
|
||||
autoClear: {
|
||||
cookies: [
|
||||
{
|
||||
name: /^_ga/, // regex: match all cookies starting with '_ga'
|
||||
},
|
||||
{
|
||||
name: '_gid', // string: exact cookie name
|
||||
}
|
||||
]
|
||||
},
|
||||
// See: https://cookieconsent.orestbida.com/reference/configuration-reference.html#category-services
|
||||
services: {
|
||||
[SERVICE_ANALYTICS_STORAGE]: {
|
||||
label: 'Enables storage (such as cookies) related to analytics e.g. visit duration.',
|
||||
}
|
||||
}
|
||||
},
|
||||
[CAT_ADVERTISEMENT]: {
|
||||
enabled: true,
|
||||
services: {
|
||||
[SERVICE_AD_STORAGE]: {
|
||||
label: 'Enables storage (such as cookies) related to advertising.',
|
||||
},
|
||||
[SERVICE_AD_USER_DATA]: {
|
||||
label: 'Sets consent for sending user data related to advertising to Google.',
|
||||
},
|
||||
[SERVICE_AD_PERSONALIZATION]: {
|
||||
label: 'Sets consent for personalized advertising.',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
[CAT_SECURITY]: {
|
||||
enabled: true,
|
||||
services: {
|
||||
[SERVICE_SECURITY_STORAGE]: {
|
||||
label: 'Enables storage related to security such as authentication functionality, fraud prevention, and other user protection.',
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
language: {
|
||||
default: 'uk',
|
||||
translations: {
|
||||
uk: {
|
||||
consentModal: {
|
||||
title: 'Ми використовуємо файли cookie',
|
||||
description: 'Цей веб-сайт використовує основні файли cookie для забезпечення належної роботи та файли cookie для відстеження, щоб зрозуміти, як ви з ним взаємодієте. Останні будуть встановлені лише після отримання згоди.',
|
||||
acceptAllBtn: 'Прийняти всі',
|
||||
acceptNecessaryBtn: 'Відхилити всі',
|
||||
showPreferencesBtn: 'Керування індивідуальними налаштуваннями'
|
||||
},
|
||||
preferencesModal: {
|
||||
title: 'Керування налаштуваннями файлів cookie',
|
||||
acceptAllBtn: 'Прийняти всі',
|
||||
acceptNecessaryBtn: 'Відхилити всі',
|
||||
savePreferencesBtn: 'Прийняти поточний вибір',
|
||||
closeIconLabel: 'Закрити вікно',
|
||||
sections: [
|
||||
{
|
||||
title: "Використання файлів cookie",
|
||||
description: "Ми використовуємо файли cookie для забезпечення основних функцій веб-сайту та покращення вашого онлайн-досвіду."
|
||||
},
|
||||
{
|
||||
title: "Строго необхідні файли cookie",
|
||||
description: "Ці файли cookie необхідні для правильного функціонування веб-сайту, наприклад, для автентифікації користувачів.",
|
||||
linkedCategory: CAT_NECESSARY,
|
||||
},
|
||||
{
|
||||
title: "Аналітика",
|
||||
description: 'Файли cookie, які використовуються для аналітики, допомагають збирати дані, які дозволяють сервісам розуміти, як користувачі взаємодіють з певним сервісом. Ці дані дозволяють сервісам покращувати контент і створювати більш якісні функції, що покращують користувацький досвід.',
|
||||
linkedCategory: CAT_ANALYTICS,
|
||||
cookieTable: {
|
||||
headers: {
|
||||
name: "Ім'я",
|
||||
domain: "Сервіс",
|
||||
description: "Опис",
|
||||
expiration: "Термін дії"
|
||||
},
|
||||
body: [
|
||||
{
|
||||
name: "_ga",
|
||||
domain: "Google Analytics",
|
||||
description: "Файл cookie, встановлений <a href=\"https://business.safety.google/adscookies/\">Google Analytics</a>",
|
||||
expiration: "Закінчується через 12 днів"
|
||||
},
|
||||
{
|
||||
name: "_gid",
|
||||
domain: "Google Analytics",
|
||||
description: "Файл cookie, встановлений <a href=\"https://business.safety.google/adscookies/\">Google Analytics</a>",
|
||||
expiration: "Сесія"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Реклама',
|
||||
description: 'Google використовує файли cookie для реклами, включаючи показ і відображення реклами, персоналізацію реклами (залежно від ваших налаштувань реклами на <a href=\"https://g.co/adsettings\">g.co/adsettings</a>), обмеження кількості показів реклами користувачеві, вимкнення реклами, яку ви вирішили більше не бачити, та вимірювання ефективності реклами.',
|
||||
linkedCategory: CAT_ADVERTISEMENT,
|
||||
},
|
||||
{
|
||||
title: 'Функціональність',
|
||||
description: 'Файли cookie, які використовуються для функціональності, дозволяють користувачам взаємодіяти зі службою або сайтом для доступу до функцій, які є основоположними для цієї служби. Те, що вважається основоположним для служби, включає в себе такі налаштування, як вибір користувачем мови, оптимізацію продукту, яка допомагає підтримувати та покращувати службу, а також підтримувати інформацію, що відноситься до сеансу користувача, наприклад вміст кошика покупок.',
|
||||
linkedCategory: CAT_FUNCTIONALITY,
|
||||
},
|
||||
{
|
||||
title: 'Безпека',
|
||||
description: 'Файли cookie, які використовуються для безпеки, автентифікують користувачів, запобігають шахрайству та захищають користувачів під час їхньої взаємодії зі службою.',
|
||||
linkedCategory: CAT_SECURITY,
|
||||
},
|
||||
{
|
||||
title: 'Більше інформації',
|
||||
description: 'З будь-яких питань, що стосуються політики щодо файлів cookie та ваших варіантів вибору, будь ласка, <a href="https://www.example.com/contacts">зв\'яжіться з нами</a>.'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
en: {
|
||||
consentModal: {
|
||||
title: 'We use cookies',
|
||||
description: 'This website uses essential cookies to ensure its proper operation and tracking cookies to understand how you interact with it. The latter will be set only after consent.',
|
||||
acceptAllBtn: 'Accept all',
|
||||
acceptNecessaryBtn: 'Reject all',
|
||||
showPreferencesBtn: 'Manage Individual preferences'
|
||||
},
|
||||
preferencesModal: {
|
||||
title: 'Manage cookie preferences',
|
||||
acceptAllBtn: 'Accept all',
|
||||
acceptNecessaryBtn: 'Reject all',
|
||||
savePreferencesBtn: 'Accept current selection',
|
||||
closeIconLabel: 'Close modal',
|
||||
sections: [
|
||||
{
|
||||
title: "Cookie usage",
|
||||
description: "We use cookies to ensure the basic functionalities of the website and to enhance your online experience."
|
||||
},
|
||||
{
|
||||
title: "Strictly necessary cookies",
|
||||
description: "These cookies are essential for the proper functioning of the website, for example for user authentication.",
|
||||
linkedCategory: CAT_NECESSARY,
|
||||
},
|
||||
{
|
||||
title: "Analytics",
|
||||
description: 'Cookies used for analytics help collect data that allows services to understand how users interact with a particular service. These insights allow services both to improve content and to build better features that improve the user’s experience.',
|
||||
linkedCategory: CAT_ANALYTICS,
|
||||
cookieTable: {
|
||||
headers: {
|
||||
name: "Name",
|
||||
domain: "Service",
|
||||
description: "Description",
|
||||
expiration: "Expiration"
|
||||
},
|
||||
body: [
|
||||
{
|
||||
name: "_ga",
|
||||
domain: "Google Analytics",
|
||||
description: "Cookie set by <a href=\"https://business.safety.google/adscookies/\">Google Analytics</a>",
|
||||
expiration: "Expires after 12 days"
|
||||
},
|
||||
{
|
||||
name: "_gid",
|
||||
domain: "Google Analytics",
|
||||
description: "Cookie set by <a href=\"https://business.safety.google/adscookies/\">Google Analytics</a>",
|
||||
expiration: "Session"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Advertising',
|
||||
description: 'Google uses cookies for advertising, including serving and rendering ads, personalizing ads (depending on your ad settings at <a href=\"https://g.co/adsettings\">g.co/adsettings</a>), limiting the number of times an ad is shown to a user, muting ads you have chosen to stop seeing, and measuring the effectiveness of ads.',
|
||||
linkedCategory: CAT_ADVERTISEMENT,
|
||||
},
|
||||
{
|
||||
title: 'Functionality',
|
||||
description: 'Cookies used for functionality allow users to interact with a service or site to access features that are fundamental to that service. Things considered fundamental to the service include preferences like the user’s choice of language, product optimizations that help maintain and improve a service, and maintaining information relating to a user’s session, such as the content of a shopping cart.',
|
||||
linkedCategory: CAT_FUNCTIONALITY,
|
||||
},
|
||||
{
|
||||
title: 'Security',
|
||||
description: 'Cookies used for security authenticate users, prevent fraud, and protect users as they interact with a service.',
|
||||
linkedCategory: CAT_SECURITY,
|
||||
},
|
||||
{
|
||||
title: 'More information',
|
||||
description: 'For any queries in relation to the policy on cookies and your choices, please <a href="https://www.example.com/contacts">contact us</a>.'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
ru: {
|
||||
consentModal: {
|
||||
title: 'Мы используем файлы cookie',
|
||||
description: 'Этот веб-сайт использует основные файлы cookie для обеспечения своей надлежащей работы и файлы cookie для отслеживания, чтобы понять, как вы с ним взаимодействуете. Последние будут установлены только после получения согласия.',
|
||||
acceptAllBtn: 'Принять все',
|
||||
acceptNecessaryBtn: 'Отклонить все',
|
||||
showPreferencesBtn: 'Управление индивидуальными настройками'
|
||||
},
|
||||
preferencesModal: {
|
||||
title: 'Управление настройками файлов cookie',
|
||||
acceptAllBtn: 'Принять все',
|
||||
acceptNecessaryBtn: 'Отклонить все',
|
||||
savePreferencesBtn: 'Принять текущий выбор',
|
||||
closeIconLabel: 'Закрыть окно',
|
||||
sections: [
|
||||
{
|
||||
title: "Использование файлов cookie",
|
||||
description: "Мы используем файлы cookie для обеспечения основных функций веб-сайта и улучшения вашего онлайн-опыта."
|
||||
},
|
||||
{
|
||||
title: "Строго необходимые файлы cookie",
|
||||
description: "Эти файлы cookie необходимы для правильного функционирования веб-сайта, например, для аутентификации пользователей.",
|
||||
linkedCategory: CAT_NECESSARY,
|
||||
},
|
||||
{
|
||||
title: "Аналитика",
|
||||
description: 'Файлы cookie, используемые для аналитики, помогают собирать данные, которые позволяют сервисам понимать, как пользователи взаимодействуют с определенным сервисом. Эти данные позволяют сервисам улучшать контент и создавать более качественные функции, улучшающие пользовательский опыт.',
|
||||
linkedCategory: CAT_ANALYTICS,
|
||||
cookieTable: {
|
||||
headers: {
|
||||
name: "Имя",
|
||||
domain: "Сервис",
|
||||
description: "Описание",
|
||||
expiration: "Срок действия"
|
||||
},
|
||||
body: [
|
||||
{
|
||||
name: "_ga",
|
||||
domain: "Google Analytics",
|
||||
description: "Файл cookie, установленный <a href=\"https://business.safety.google/adscookies/\">Google Analytics</a>",
|
||||
expiration: "Истекает через 12 дней"
|
||||
},
|
||||
{
|
||||
name: "_gid",
|
||||
domain: "Google Analytics",
|
||||
description: "Файл cookie, установленный <a href=\"https://business.safety.google/adscookies/\">Google Analytics</a>",
|
||||
expiration: "Сессия"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Реклама',
|
||||
description: 'Google использует файлы cookie для рекламы, включая показ и отображение рекламы, персонализацию рекламы (в зависимости от ваших настроек рекламы на <a href=\"https://g.co/adsettings\">g.co/adsettings</a>), ограничение количества показов рекламы пользователю, отключение рекламы, которую вы решили больше не видеть, и измерение эффективности рекламы.',
|
||||
linkedCategory: CAT_ADVERTISEMENT,
|
||||
},
|
||||
{
|
||||
title: 'Функциональность',
|
||||
description: 'Файлы cookie, используемые для функциональности, позволяют пользователям взаимодействовать со службой или сайтом для доступа к функциям, которые являются основополагающими для этой службы. То, что считается основополагающим для службы, включает в себя такие предпочтения, как выбор пользователем языка, оптимизацию продукта, которая помогает поддерживать и улучшать службу, а также поддерживать информацию, относящуюся к сеансу пользователя, например содержимое корзины покупок.',
|
||||
linkedCategory: CAT_FUNCTIONALITY,
|
||||
},
|
||||
{
|
||||
title: 'Безопасность',
|
||||
description: 'Файлы cookie, используемые для безопасности, аутентифицируют пользователей, предотвращают мошенничество и защищают пользователей при их взаимодействии со службой.',
|
||||
linkedCategory: CAT_SECURITY,
|
||||
},
|
||||
{
|
||||
title: 'Больше информации',
|
||||
description: 'По любым вопросам, касающимся политики в отношении файлов cookie и ваших вариантов выбора, пожалуйста, <a href="https://www.example.com/contacts">свяжитесь с нами</a>.'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
72
cookiesconsent.php
Normal file
72
cookiesconsent.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to https://devdocs.prestashop.com/ for more information.
|
||||
*
|
||||
* @author PrestaShop SA and Contributors <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
class cookiesconsent extends Module
|
||||
{
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'cookiesconsent';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = '0.1.1';
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->trans('cookiesconsent', [], 'Modules.Cookiesconsent.Admin');
|
||||
$this->description = $this->trans(
|
||||
'Help your customers cookiesconsent.',
|
||||
[],
|
||||
'Modules.Cookiesconsent.Admin'
|
||||
);
|
||||
$this->ps_versions_compliancy = [
|
||||
'min' => '1.7.2.0',
|
||||
'max' => _PS_VERSION_,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function install()
|
||||
{
|
||||
return parent::install() && $this->registerHook(['displayFooter']);
|
||||
}
|
||||
|
||||
|
||||
public function hookdisplayFooter()
|
||||
{
|
||||
return $this->display(__FILE__, 'footer.tpl');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
3
footer.tpl
Normal file
3
footer.tpl
Normal file
@@ -0,0 +1,3 @@
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/orestbida/cookieconsent@3.1.0/dist/cookieconsent.css" type="text/css">
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/orestbida/cookieconsent@3.1.0/dist/cookieconsent.umd.js" async></script>
|
||||
<script type="module" src="/modules/cookiesconsent/cookieconsent-config.js"></script>
|
||||
Reference in New Issue
Block a user