Jump to content

Theme customization: how to show cookie consent popup


Recommended Posts

KVS doesn't collect any tracking or commerce-related cookies, only necessary cookies are used to make sure site is operating normally and user preferences are remembered. Therefore it is not possible to switch off any cookies, as they are all needed for KVS functionality to work. But EU countries require sites in their area to inform users about cookie usage. If this is the case for your site, you can use the below steps to display basic cookie consent popup.

cookie_consent.png.f601411e85e78a2a5d639eaffe056e24.png

 

Step 1. Download and copy this file to your project:

https://www.kvs-demo.com/static/js/cookieconsent.min.js

 

Step 2. Go to Website UI -> Page components -> include_footer_general.tpl and paste the following code before the closing </body> tag:

<script src="{{$config.statics_url}}/static/js/cookieconsent.min.js"></script>
<script>
  window.CookieConsent.init({
    modalMainTextMoreLink: null,
    barTimeout: 500,
    theme: {
      barColor: '#1554b2',
      barTextColor: '#FFF',
      barMainButtonColor: '#FFF',
      barMainButtonTextColor: '#1554b2',
      modalMainButtonColor: '#1554b2',
      modalMainButtonTextColor: '#FFF',
    },
    language: {
      current: 'en',
      locale: {
        en: {
          barMainText: 'This website uses cookies to ensure you get the best experience on our website.',
          closeAriaLabel: 'close',
          barLinkSetting: 'Cookie Settings',
          barBtnAcceptAll: 'Accept all cookies',
          modalMainTitle: 'Cookie settings',
          modalMainText: "Cookies are small pieces of data sent from a website and stored on the user's computer by the user's web browser while the user is browsing. Cookies were designed to be a reliable mechanism for websites to remember information or to record the user's browsing activity.'",
          modalBtnSave: 'Save current settings',
          modalBtnAcceptAll: 'Accept all cookies and close',
          modalAffectedSolutions: 'Affected solutions:',
          learnMore: 'Learn More',
          on: 'On',
          off: 'Off',
          enabled: 'is enabled.',
          disabled: 'is disabled.',
          checked: 'checked',
          unchecked: 'unchecked',
        }
      }
    },
    categories: {
      necessary: {
        needed: true,
        wanted: true,
        checked: true,
        language: {
          locale: {
            en: {
              name: 'Strictly Necessary Cookies',
              description: "We do not collect any tracking or personal data and use only necessary cookies to make sure you don't experience any issues while visiting our site.",
            }
          }
        }
      }
    },
  });
</script>

Adjust colors and texts if needed.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...