Cookie compliance integration for Drupal 8

Cookie compliance integration for Drupal 8

Nelson
Written by NelsonLast update 1 month ago

To install the CookieScript cookie banner code on Drupal 8, perform the following steps:

  1. Go to your Cookie-Script.com account > Settings > Installation.

  2. Configure geo-targeting (if needed).

  3. Download the CookieScript js file from the Installation section. If you need, read more about self-hosting of js files.

  4. Open your Drupal asset library's theme-name.libraries.yml file in your theme folder.

  5. Under js: line, paste the CookieScript file location (file path) as shown below, where your-cookie-script-hash-number.js is your downloaded CookieScript js file.

    # theme-name.libraries.yml 
    global-styling:
     version: 1.x 
     css:
     theme:
    global-scripts:
     version: 1.x 
     js: 
     js/your-cookie-script-hash-number.js: {}
    

CookieScript is installed on Drupal 8 now and should be ready for use.

Note: If the banner doesn’t appear after the implementation, check if you don’t use any Cache plugin or extension, which prevents the banner from popping-up.  

Did this answer your question?