Cookie compliance integration for PrestaShop 1.7

Cookie compliance integration for PrestaShop 1.7

Nelson
Written by NelsonLast update 27 days ago

To install the CookieScript cookie banner code on PrestaShop 1.7, perform the following steps:

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

  2. Configure geo-targeting (if needed).

  3. Copy your item's src attribute's value (i.e. the file URL) from your CookieScript code.

  4. Open to {project_directory}/classes/controller/FrontController.php file.

  5. Go to setMedia() function.

  6. Add the following code, where your-file-URL is your item's src attribute value.

    $this->registerJavascript(
    'remote-bootstrap',
    'your-file-URL',
    ['server' => 'remote', 'position' => 'head', 'priority' => 20]
    );
    

There are 2 positions where you can set your CookieScript file:

  1. The top of the page (inside <header>) by setting the position to top like this ‘position’ => ‘top’. 

  2. The end of the tag <body> by ‘position’ => ‘bottom’. 

CookieScript is installed on PrestaShop 1.7 now and should be ready for use.

Did this answer your question?