PicoCookieBAR

le 05/07/2018 dans Pico CMS #dev#php#Pico CMS#plugin

This blog post is a copy – mainly – of the PicoCookieBAR README.md from its repository on GitHub.

This plugin, for Pico 2, generates the script tag that calls a personnalized cookiebar. It uses the light and jQuery-free cookieBAR, a script written by Emanuele Toscano.

PicoCookieBAR doesn't provide the extensive potential configuration of the cookieBAR (refer to this page) but it seems quite enough at the moment. You can open an issue for any demand.

This plugin is needed for my PicoSimpleStats plugin (on this blog | on GitHub).

Installation

/!\ No matter the way you install the plugin, it's mandatory you name the plugin folder PicoCookieBAR.

Using GIT

Just move to your Pico CMS plugins directory and run:

$ git clone https://github.com/bricebou/PicoCookieBAR.git

and jump to the Configuration section below.

Otherwise

Download the latest zip archive from Github and unzip it inside the plugins/PicoCookieBAR/.

Configuration

Version 2 of Pico CMS introduces YAML configuration files.
Parameters for the PicoCookieBAR plugin can be inserted into the config/config.yml file or put in a specific .yml file inside the config folder.

PicoCookieBAR.enabled: true
# Cookiebar theme to use ?
# Let it empty for default theme (black)
# Choices : altblack, flying, grey, white
# You can make your own theme (see the PicoSimpleStats README)
cookiebar_theme: ""
# Place the cookiebar at the top of your website
cookiebar_top: false
# If set to true: the cookieBAR is displayed
# regardless the user's location  
cookiebar_nogeoip: true
# Tracking cookies (Matomo, Google Analytics, ...)
cookiebar_tracking: true
# Any third-party cookies ?
cookiebar_third_party: true
# Conditionning the Google Analytics and/or Matomo tracking codes
# to the acceptance of cookies. Reload the page on acceptance
cookiebar_preventive: true
# Show the "Disable" button
# When `cookiebar_preventive` is set to true,
# the user can prevent the plugin to load tracking js code.
cookiebar_disallow: true
# Hide the details popup link
cookiebar_hide_details: false
# Do you have a Privacy page ?
cookiebar_privacy_page: "/about/#cookies"

Theming the cookiebar

You just have to copy one of the .css files from the plugins/PicoCookieBAR/cookiebar/themes and edit as you want.

/!\ You'll have to minify your .css file or at least name it following this pattern: cookiebar-mytheme.min.css.

Personalization of the cookiebar texts

You can modify the texts displayed by the cookieBAR script by simply editing the html files stored inside the plugins/PicoCookieBAR/cookiebar/lang folder.