Socket
Socket
Sign inDemoInstall

@adv-ui/universal-consents-cookies-widget

Package Overview
Dependencies
106
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.3 to 1.4.0

5

package.json
{
"name": "@adv-ui/universal-consents-cookies-widget",
"version": "1.3.3",
"version": "1.4.0",
"description": "",

@@ -20,3 +20,3 @@ "main": "lib/app.js",

"test": "echo \"Error: no test specified\" && exit 1",
"umd": "sui-bundler lib src-umd/index.js -o umd/ -p --root"
"umd": "NODE_ENV=production sui-bundler lib src-umd/index.js -o umd/ -p --root"
},

@@ -39,2 +39,3 @@ "repository": {

"@adv-ui/boros-reporter": "1",
"@adv-ui/vendor-by-consents-loader": "1.2.0",
"@s-ui/react-tcf-ui": "2",

@@ -41,0 +42,0 @@ "react": "17.0.1",

# @adv-ui/universal-consents-cookies-widget [![Build Status](https://travis.mpi-internal.com/scmspain/frontend-all--consents-cookies-widget-pack.svg?token=rg6VMzkvzMeJr1v4tr6s&branch=master)](https://travis.mpi-internal.com/scmspain/frontend-all--consents-cookies-widget-pack)
## How to use?
Add the next code on the `<head>` of your website in order to show the Consent Cookies Widget in case it's needed for the user.
```html
<script defer src='https://unpkg.com/@adv-ui/universal-consents-cookies-widget/umd/index.js'></script>
<link rel='stylesheet' href='https://unpkg.com/@adv-ui/universal-consents-cookies-widget/umd/styles.css'>
```
When the user accepts or rejects it, the modal will disappear.
### Adding a link to open manually Consents Cookies Widget
You must offer to the user the possibility to open the widget to change the consents anytime. For that, you could add this HTML in order to give this feature to the user.
```html
<a href='#' onclick="window.__callUniversalConsentsCookiesWidget()">Gestionar consentimientos de cookies</a>
```
## Configuration
You could config some aspects of the widget by using a window object called `universalConsentsCookiesWidget`.
**Important:** Config should be placed BEFORE loading the widget.
```html
<script>
window.__mpi.universalConsentsCookiesWidget = {
logo: 'https://your-domain.com/your-awesome-logo.png'
}
</script>
<script defer src='https://unpkg.com/@adv-ui/universal-consents-cookies-widget/umd/index.js'></script>
```
## Load scripts for some consents
Once you have the consents widget implemented in your site, you'll be able to listen when the user has consented some purposes in order to load some specific tags.
For example, for adding loading tealium after user is giving consents you should do:
```html
<script>
// init vendors loader by consents
window.sui.vendors.initVendorConsentsLoader({
vendors: {
tealium: {
// script to load
script: 'https://frtassets.fotocasa.es/external-scripts/utag-pro.js',
// consents needed for this script
consents: {
purposes: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
specialFeatureOptins: [1]
}
},
}
})
</script>
```
Please, **keep in mind that if the user doesn't provide needed consents the script won't be loaded.**
[Check list of purposes by ID.](https://github.mpi-internal.com/scmspain/frontend-all--vendor-by-consents-loader#list-of-purposes).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc