Skip to content

Commit

Permalink
Modified cookie consent view
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergei Tsoganov authored and Sergei Tsoganov committed Dec 6, 2023
1 parent 7271577 commit b6ea7f9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
32 changes: 23 additions & 9 deletions src/components/common/CookieConsent/CookieConsentConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Cookies from 'universal-cookie';
import GA from '../../../utils/googleAnalytics';
const cookies = new Cookies();
const pluginConfig = {
current_lang: cookies.get('locale'),
current_lang: cookies.get('locale') || 'et',
autoclear_cookies: true,
page_scripts: true,
cookie_name: 'cc_cookie',
Expand All @@ -30,19 +30,33 @@ const pluginConfig = {
}
},

gui_options: {
consent_modal: {
layout: 'cloud',
position: 'bottom center',
transition: 'slide',
swap_buttons: false,
},
settings_modal: {
layout: 'box',
position: 'right',
transition: 'slide',
},
},

languages: {
en: {
consent_modal: {
title: 'We use cookies!',
description:
'Our 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. <button type="button" data-cc="c-settings" class="cc-link">Let me choose</button>',
'Our website uses cookies to personalize content and ads, and to provide social media features. We ask for your permission to use cookies that are not necessarily essential for the basic functions of our website. Please read our detailed descriptions and rules of cookies <a class="cc__link" href="https://www.internet.ee/eif/cookies-on-internet-ee-webpage">here</a>.',
primary_btn: {
text: 'Accept all',
role: 'accept_all', // 'accept_selected' or 'accept_all'
},
secondary_btn: {
text: 'Reject all',
role: 'accept_necessary', // 'settings' or 'accept_necessary'
text: 'Settings',
role: 'settings', // 'settings' or 'accept_necessary'
},
},
settings_modal: {
Expand All @@ -61,7 +75,7 @@ const pluginConfig = {
{
title: 'Cookie usage',
description:
'We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below. The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. For more details relative to cookies and other sensitive data, please read the full <a href="https://www.internet.ee/eif/cookies-on-internet-ee-webpage" class="cc-link">privacy policy</a>.',
'We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below. The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site.',
},
{
title: 'Strictly necessary cookies',
Expand Down Expand Up @@ -112,14 +126,14 @@ const pluginConfig = {
consent_modal: {
title: 'Kasutame küpsiseid!',
description:
'Meie veebisait kasutab olulisi küpsiseid selle nõuetekohaseks toimimiseks ning jälgimisküpsiseid, et mõista, kuidas te sellega suhtlete. Viimased seatakse alles pärast nõusolekut. <button type="button" data-cc="c-settings" class="cc-link">Muuda küpsiste seadistusi</button>',
'Kasutame küpsiseid sisu ja reklaamide isikupärastamiseks, sotsiaalse meedia funktsioonide pakkumiseks. Küsime sinult luba, et kasutada küpsiseid, mis ei ole tingimata vajalikud meie veebilehe põhifunktsioonide toimimiseks. Palun loe meie küpsiste üksikasjalikke kirjeldusi ja reegleid <a class="cc__link" href="https://www.internet.ee/eis/kupsised-internet-ee-lehel">siit</a>.',
primary_btn: {
text: 'Luba kõik',
role: 'accept_all', // 'accept_selected' or 'accept_all'
},
secondary_btn: {
text: 'Reject all',
role: 'accept_necessary', // 'settings' or 'accept_necessary'
text: 'Seadistused',
role: 'settings', // 'settings' or 'accept_necessary'
},
},
settings_modal: {
Expand All @@ -138,7 +152,7 @@ const pluginConfig = {
{
title: 'Küpsiste kasutamine',
description:
'Kasutame küpsiseid, et aidata Teil tõhusalt navigeerida ja teatud funktsioone täita. Üksikasjalikku teavet kõigi küpsiste kohta leiate allpool iga nõusolekukategooria alt. Küpsised, mis on liigitatud kui "Vajalikud", salvestatakse Teie brauserisse, kuna need on olulised saidi põhifunktsioonide võimaldamiseks. Küpsiste ja muu tundliku teabe kohta lisateabe saamiseks lugege täielikku <a href="https://www.internet.ee/eis/kupsised-internet-ee-lehel" class="cc-link">privaatsuspoliitikat</a>.',
'Kasutame küpsiseid, et aidata Teil tõhusalt navigeerida ja teatud funktsioone täita. Üksikasjalikku teavet kõigi küpsiste kohta leiate allpool iga nõusolekukategooria alt. Küpsised, mis on liigitatud kui "Vajalikud", salvestatakse Teie brauserisse, kuna need on olulised saidi põhifunktsioonide võimaldamiseks.',
},
{
title: 'Vajalikud küpsised',
Expand Down
8 changes: 5 additions & 3 deletions src/utils/googleAnalytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ReactGA from 'react-ga';
import { Route } from 'react-router-dom';
import Cookies from 'universal-cookie';

const { REACT_APP_GA_TRACKING_ID } = process.env;
class GoogleAnalytics extends Component {
Expand Down Expand Up @@ -70,12 +71,13 @@ const hasConsentForAnalytics = () => {
};

const removeGACookies = () => {
const cookies = document.cookie.split(';');
const cookies = new Cookies().getAll(); // document.cookie.split(';');

cookies.forEach((cookie) => {
Object.keys(cookies).forEach((cookie) => {
const cookieName = cookie.split('=')[0].trim();
if (cookieName.match(/^(_ga|_gid|_gat|.+\._ga|.+\._gid|.+\._gat)$/)) {
document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;
// document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;
cookies.remove(cookieName);
}
});
};
Expand Down

0 comments on commit b6ea7f9

Please sign in to comment.