Download the PHP package omatech/oma-cookies without Composer
On this page you can find all versions of the php package omatech/oma-cookies. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package oma-cookies
Oma-cookies
Built-in solution that allows the control of cookies,
enabling GDPR compliance for Omatech internal projects.
Table of contents
-
Installation
- JavaScript import
- CSS/SASS import
-
Implementation
- Iframes
- Scripts
-
Methods
- Open cookies consent selection modal
-
Configuration
- Override language strings
- Adding a new language
- Setting the default language
- Read more link
- Format
- Quick link position
- License
- Contact
Installation
Install the package
JavaScript import
Import the main js file into your project:
Optionally you can copy into a public folder the JS file located inside
the /node_modules/@omatech/oma-cookies/dist/js
folder and link it in your HTML layout
CSS/SASS import
There are 2 approaches depending on your styling method:
A) If you are ONLY overriding CSS classes => Import the compiled CSS file
Optionally you can copy into a public folder the CSS file located inside
the /node_modules/@omatech/oma-cookies/dist/css
folder and link it in your HTML layout
B) If you want to override the variables and CSS classes => Import all the separated files
Regardless of what option you choose, make sure this line is in your HTML layout so the responsive works properly.
Implementation
To start things up, you must add this somewhere in your HTML layout (preferably at the end)
Iframes
Every iframe must have the attribute data-omacookies-consent
which has 2 possible values marketing
or statistics
. This specitfy when the content will be un/blocked
YouTube videos
The attribute data-omacookies-yt-video-id
is the ID found at the end of every YouTube video URL. In /watch?v=uu5k19UaCT0
the ID would be uu5k19UaCT0
Generic iframe
The attribute data-omacookies-src
would work as the normal iframe src
attribute
You can add any attribute to the rendered iframe using the attribute data-omacookies-xxx
. Simply change xxx
for any other attribute. See the attribute width
shown in the example.
Scripts
It is required to add the type="text/plain"
attribute.
-
For file JavaScript scripts
- For inline JavaScript code
↑ Back to top
Methods
Open cookies consent selection modal
↑ Back to top
Configuration
Somewhere after the import of the omacookies
JS file we will override attributes from the main object.
Override language strings
We can set a new value for any language string with the following declaration:
Adding a new language
We can add as many languages as we want, we just need to follow the same object structure we already have for ES and EN.
You can copy the structure from /node_modules/@omatech/oma-cookies/src/lang/en.json
For example, we will add German language:
Setting the default language
Make sure to set the language after you make any modifications to the available_languages
object.
Read more link
Here we will add the website link where the user will be redirected to read the cookie policy.
Format
Here we can set the appearance of the initial cookie dialog. The allowed values are modal
(default) or banner
.
Enable/disable quick link
The quick link is enabled by default. Disable it setting the following:
To open the cookies selection modal when disabled, use the this method
Quick link position
Here we can configure in which corner of the screen will the quick link be located, using the values top-right
, top-left
, bottom-right
or bottom-left
. The quick link will appear on the bottom-right
by default.
↑ Back to top
License
This project has MIT license. For further information, read the LICENSE
file.
↑ Back to top
Contact
- Website: www.omatech.com
- Email: [email protected]
- LinkedIn: LinkedIn Omatech
- Project Link: GitHub Oma-cookies
↑ Back to top