By Rishabh Ranjan Jha on 2021-07-29 10:45 in GSoC 21 Feature Enhancement - 2

Date: 19 July 2021 - 25 July 2021

Location: Glip

Hi, this is the progress report for the cookie manager project which is currently part of GSoC.

In the 7th week of the program, we implemented the cookie block/unblock process using a system plugin.

Discussion Outline:

This week, we implemented the cookie block/unblock process which was discussed in this report (week 5) with some modifications in it.

Tasks completed this week:

  • We have implemented a JavaScript-based solution for the cookie block/unblock process.
  • Admin has to include all the cookie setting codes in the backend in the Cookie manager scripts section.
  • On users’ first visit, scripts that require consent will not be rendered.
  • Also, we block iframes, embeds, objects, links, and images that can set cookies on the first visit.
  • All the scripts that are generating cookies, will be sent from backend to frontend using addScriptOptions, based on the user’s consent options.
  • For blocking of iframes, embeds, links, we use regex to search for the particular iframes, links and change the attribute to block, according to its type.
  • According to the consented category, required scripts will be executed.
  • Scripts will be executed according to their position also.
  • For executing scripts, we use document.createRange() to parse the script.
  • Once users’ gave consent, we set a cookie for each category with its value true and false, cookie_category_[category]=true or cookie_category_[category]=false.
  • When users set their preferences, then one cookie cookieBanner=shown will be set. All the cookie consent and cookie banner related information will be merged into one single cookie on a future update.
  • Script codes will be sent from backend to frontend only if the cookie for that category has not been set.
  • On subsequent visits, scripts will be rendered according to cookie cookie_category_[category].
  • We use an output buffer with the str_replace function to replace the old content with the new content which includes scripts, according to its position.
  • The cookie banner will be shown to the users only if cookieBanner=shown has not been set.


Pull Request -