Giter Site home page Giter Site logo

discre-to / discreto Goto Github PK

View Code? Open in Web Editor NEW
15.0 2.0 1.0 1.17 MB

You have the right to stay anonymous (GPDR compliance made easy)

Home Page: https://discre.to

License: MIT License

HTML 3.19% JavaScript 84.62% PHP 0.68% SCSS 11.51%
gdpr gdpr-compliant gdpr-consent gdpr-cookie rgpd

discreto's Introduction

discreto

discreto

you have the right to stay anonymous
(GDPR compliance made easy)

Links

Getting Started

Prerequisites

First, if not already, get npm: https://www.npmjs.com/get-npm

Then, set up your webserver to point to the root folder of the project.

Assuming you're using the domain discreto.localhost, your virtual host configuration on your Apache server would look like:

<VirtualHost *:80>
  ServerName discreto.localhost
  DocumentRoot "/path/to/discreto"
</VirtualHost>

Or on nginx:

server {
  listen 80;
  server_name discreto.localhost;
  root "/path/to/discreto";
}

Installing

You'll need webpack, sass and a few plugins to build from the JS and Sass sources, so let's make it simple:

npm install

Copy the default configurations for the live page (live/index.html) and the test page (test/index.html):

cp live/config.ini.json live/config.json
cp test/config.ini.js test/config.js

Specifications

Configuration

Configuration is read from the global variable window.discretoConf (if set) or passed as an argument to discreto.start().

Configuration can either be an object:

window.discretoConf = {
  gui: {
    logo: '/your/logo.svg'
  },
  cookie: {
    name: 'gdpr_cookie'
  },
  ids: {
    analytics: 'UA-XXXXXXX-Y'
  },
  services: {
    analytics: {
      types: [ 'audience' ],
      load: 'pageView'
    }
  }
}

A GTM event:

window.discretoConf = 'gtm://GTM-XXXXXXX/config'

Or a JSON resource:

window.discretoConf = '/your/config.json'

Use the wizard or read more about configuration in the documentation.

ES6 Module

discreto is written in ES6, and you can load it directly within your page:

<script src="src/discreto.js" type="module"></script>

Or you can import it in your project as an ES6 or CommonJS module:

import 'src/discreto.js'

Sass

Style is built from Sass files located in src/scss. The live page requires dist/discreto.css than can be built using:

sass src/discreto.scss dist/discreto.css

Or using npm:

npm run-script sass

If you want to watch changes:

sass --watch src:dist

Or:

npm run-script watch

Translations

At the moment only English and French are supported, all contributions are welcome, as well as spelling corrections and suggestions. See src/i18n.

Live preview

You can use the live page (live/index.html) to get a preview, configuration being read from live/config.json:

http://discreto.localhost/live

Running the tests

Tests are written with mocha and expect.js. They shall pass. They can be run using the command line:

npm test

Or using the test page (test/index.html):

http://discreto.localhost/test

Cross-Origin Resource sharing

If you plan on testing CORS (see test/utils.js), you will need to define an alias for your server name, and add support for PHP (see test/message.php).

You can skip these tests by setting window.CORS = false in test/config.js (by default).

Deployment

Build and minify JS & CSS using webpack with the provided configuration (webpack.conf.js):

webpack -c webpack.config.js

Or using npm:

npm run-script build

Built files can be found in dist:

  • discreto.min.js: packed module and dependencies
  • discreto.min.css: minified CSS with inline image (base64)

Keep them in the same directory, let's say discreto/, and call the script in your page just before the </body> tag:

<script>window.discretoConf = { CONFIG }</script>
<script src="/discreto/discreto.min.js"></script>

Built with

See package.json for the list of dependencies.

License

discreto is released under the MIT License. See the LICENSE file for details.

discreto's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

klehm

discreto's Issues

Uncaught TypeError: au.shift is not a function

Bonjour,
Et merci pour discre.to. C'est vraiment un outil simple et qui me facilite grandement la vie.

J'essaie d'implanter matomo avec discreto mais j'ai l'erreur suivante dans la console JS :

Uncaught TypeError: au.shift is not a function
    at aj (piwik.js:12:463)
    at ah (piwik.js:67:105)
    at Object.addTracker (piwik.js:69:112)
    at piwik.js:72:327
    at piwik.js:72:889

Pourriez-vous m'aider à y voir plus clair sur cette erreur s'il vous plait ?

Merci d'avance

define other cookie as default

I am trying to load other cookie as default beside Cookie cookie consent, but just one of them is loaded, how can i do please?

Cookie expiration date is wrong

When I use discreto.min.js on your my server and not from yours, the expiration date is wrong. when i specify 365 days the expiration date is ../../2051 , 31 years.
I think you can add parseInt() to y.cookie.days

Charger Discreto en Anglais

Bonjour,
Encore merci pour Discreto. C'est vraiment très agréable de l'utiliser.

Par défaut, Discreto est en Français et je cherche à le charger en Anglais. J'ai donc rajouté cette ligne dans la partie gui de mon fichier config.json :
"lang": "en",

Mais je ne vois aucun changement sur le site : j'ai bien shooté mes cookies et j'ai même changé la langue par défaut du navigateur.
Je ne comprend pas ce que j'ai pu oublier de faire.
Merci de votre aide.

lazy load script dont work

I am trying to load an image with lazy loading true picture tag but because the discreto script is loaded first, lazy loading script is not applyed, how can I do please?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.