Download the PHP package itemvirtual/cookies-popup without Composer
On this page you can find all versions of the php package itemvirtual/cookies-popup. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download itemvirtual/cookies-popup
More information about itemvirtual/cookies-popup
Files in itemvirtual/cookies-popup
Package cookies-popup
Short Description Cookie consent management for Laravel projects
License MIT
Homepage https://github.com/itemvirtual/cookies-popup
Informations about the package cookies-popup
Cookies popup
Laravel package
This package provides a popup layer to manage cookies consent
Installation
You can install the package via composer:
Publish config file (with --force option to update)
You need to add package cookies name to the EncryptCookies except array
In laravel 11 you should add the cookies name to the encryptCookies method in your application's bootstrap/app.php file
Generate translations
There is a command to create the required translations in labels section
If you prefer to create the translations in a file, these are the necessary indexes
Usage
Print popup
To add cookie popup, put this code after footer in your html layout
If you set add-inline-styles to false in your config/cookies-popup.php. You should use getHeadStyles() inside your <head> html tag
To add a link to open the cookie popup, use the id cookies-popup-show parameter
Check if cookies are allowed
To hide or show content related with the cookies consent, use the allowed methods
Add Google Analytics scripts
To add the scripts in your layout (gtag.js or analytics.js), use the method you need ()
You need to add an env variable GA_MEASUREMENT_ID it can be a comma separated array
The analytics.js script can be normal or async script more info
analytics.js
Universal Analytics (gtag.js)
Styling
To styling your pop-up window, you have two options.
The custom_styles or custom_classes config parameters.
With custom_styles you can change some CSS styles. If you need a deeper design change,
use custom_classes, which will concatenate your class to the generic one
Documentation links
Google Consent Mode
Cómo configurar el modo de consentimiento en sitios web
Cómo solucionar problemas del modo de consentimiento con Tag Assistant
Tag Manager consent mode support
Google Tag Assistant
Google Consent Mode
| Consent Mode | Categoría | Descripción |
|---|---|---|
| ad_storage | Publicitarias | Es para almacenamiento relacionado con publicidad. |
| ad_user_data | Publicitarias | Recoge datos del usuario para personalización de anuncios. |
| ad_personalization | Publicitarias | Controla si los anuncios se personalizan. |
| analytics_storage | Analíticas | Para el uso de herramientas como Google Analytics. |
| functionality_storage | Funcionales | Almacena configuraciones relacionadas con la funcionalidad del sitio. |
| personalization_storage | Funcionales | Relacionado con la personalización no publicitaria. |
| security_storage | Necesarias | Para almacenamiento relacionado con seguridad y prevención de fraude. |
Function not defined
If you don't add the analytics code getGtagJs() or getAnalyticsJs() and you get the message Uncaught ReferenceError: setAnalyticalConsent/setAdvertisingConsent is not defined, you'll need to add this script.
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Credits
- Sergio
- Itemvirtual
- All Contributors
License
The MIT License (MIT). Please see License File for more information.