Git Product home page Git Product logo

gdpr_onetrust's Introduction

gdpr-onetrust

OneTrust GDPR Library displays an overlay on the website to make users aware of the fact that cookies are being set. The user may then give his/her consent or move to a page that provides more details regarding the cookies being dropped on the website. Consent is given by user accepting the agree with buttons or by continuing browsing the website. The library uses OnTrust services, so a UUID needs to be procured from OneTrust https://onetrust.com/.

Installation

  1. Run composer install

    composer install
    

Usage

  1. Autoload and include library :

    define('ROOT', __DIR__ . DIRECTORY_SEPARATOR);
    define('VENDOR', ROOT . 'vendor' . DIRECTORY_SEPARATOR);
    require VENDOR . 'autoload.php';
    
  2. Include the namespace and initialize.

    use \Gdpr\Gdpr\Gdpronetrust;
    $gdpr = Gdpronetrust::instance();
    
  3. Identify the categories and its ID's.

    eg:
        * Strictly Necessary Cookies => 1
        * Performance Cookies => 2
        * Functional Cookies  => 3
        * Targeting Cookies => 4
    
  4. Use the function to achieve the cookie blocking.

    Insertscript:

    $gdpr->($js_path, $selector = "head", $callback, $options, $js_group, $inline = FALSE);
     /**
       * @param string $js_path
       *  The javascript file path
       * @param string $selector
       *  The location to load the js 'head', 'body', '<parent id>'
       * @param $callback
       *  A JavaScript function to be called once the <script> tag has been inserted
       * @param $options
       *  A list of behaviours for when the <script> tag is inserted
       * @param $js_group
       *  Group id for which the <script> tag will be inserted
       * @param bool $inline
       *  Set TRUE if js should be loaded inline, ie. outside optanon wrapper.
       * @return string
       */
    

    Inserthtml:

    $gdpr->optanonInserthtml($element, $selector, $callback, $options, $groupid, $inline = FALSE);
    /**
       * @param $element
       *  Html tag to be inserted
       * @param $selector
       *  Html parent element id where the element will be inserted
       * @param $callback
       *  A javascript function to be called once the element has been inserted
       * @param $options
       *  A list of behaviours for when the element is inserted
       * @param $groupid
       *  Group id for which the element will be inserted.
       * @param bool $inline
       *  Set TRUE if js should be loaded inline, ie. outside optanon wrapper.
       * @return string
    */
    
  5. Use the function to publish.

    $gdpr->optanonPublishScript();
    

gdpr_onetrust's People

Contributors

rageshchalil avatar

Watchers

 avatar

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.