By Rishabh Ranjan Jha on 2021-07-13 04:55 in GSoC 21 Feature Enhancement - 2

Date: 5 July 2021 - 11 July 2021

Location: Glip

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

In the 5th week of the program, we discussed how to block cookies along with the database design for storing the cookie scripts. Moreover, part of the discussion was the Admin UI’s elements and functions to manage the different types of scripts.

Discussion Outline:

Admin UI for storing cookie scripts in the database table cookiemanager_scripts

  • Scripts: List view
    • Title
    • Status
    • Type of the script
    • Category
    • ID
  • Script: Edit view
    • Title with alias
    • Position: list type with options
      • After begin head
      • Before end head
      • After begin body
      • Before end body
    • Type: list type with options
      •  Script
      • External script
      •  Iframe
      •  Embed
      •  Object
      •  Link
      • Img
    • Code: textarea for cookie script (script should be without comments)
    • Status
    • Category

Cookie block/unblock process

  • For implementing the cookie block/unblock process, we use a JavaScript solution.
  • First, in the plugin, we render the cookie scripts with some modifications to them according to their type.
  • Replace type=’text/javascript’ with  type=’text/plain’ in the script tags, so that the script will not execute before the user's consent.
  • Replace src with data-src in iframe, embed and img tags.
  • Replace href with data-href in the link tag.
  • Add another attribute to the scripts, data-cookiecategory with the value of its category.
  • When the user will give consent, then will execute the script for that particular category to set the cookies, according to the position.
  • Finally, we set one extra cookie [category]_cookie = true for the category that the user gave consent to.
  • When the user requests another page, we render the cookie scripts according to the [category]_cookie in the response.
  • If the user revokes the consent, we change [category]_cookie to false, and in the next response, we don’t render the scripts.