Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
@68publishers/cookie-consent-resolver
Advanced tools
Changelog
1.0.1 - 2023-05-17
Readme
Utility for 68publishers/cookie-consent that allows you to inject scripts without waiting for the cookies widget to load!
In some cases, it is desirable to run some scripts as soon as possible, and initializing the cookie widget may slow down the execution of these scripts. This package allows scripts to be injected into the page immediately if the user has already given consent.
The first option is to download the package as a module.
$ npm i --save @68publishers/cookie-consent-resolver
# or
$ yarn add @68publishers/cookie-consent-resolver
And import it in your project.
import CookieConsentResolver from '@68publishers/cookie-consent-resolver';
// or
const CookieConsentResolver = require('@68publishers/cookie-consent-resolver');
Or you can import the CookieConsentResolver
into the browser from the CDN
<script src="https://unpkg.com/@68publishers/cookie-consent-resolver/dist/cookie-consent-resolver.min.js"></script>
var cookieConsentResolver = CookieConsentResolver.createFromCookie('cc-settings');
cookieConsentResolver.bindCookieConsentWrapper(CookieConsentWrapper);
// the following script will be injected if the `ad_storage` is enabled
cookieConsentResolver.injectScript('ad_storage', 'https://www.example.com/my-script.js');
// the following script will be injected if the `ad_storage` and `analytics_storage` are enabled
cookieConsentResolver.injectScript(['ad_storage', 'analytics_storage'], 'https://www.example.com/my-script2.js');
Additional <script>
tag attributes can be provided in the third argument.
cookieConsentResolver.injectScript('ad_storage', 'https://www.example.com/my-script.js', {
id: 'my-script',
async: true,
});
If you want to do anything other than inject the script in case of consent, you can use the resolve()
method.
cookieConsentResolver.resolve('ad_storage', () => {
console.log('Ad storage is enabled!');
});
The package is distributed under the MIT License. See LICENSE for more information.
FAQs
Inject scripts without waiting for the cookies widget to load!
We found that @68publishers/cookie-consent-resolver demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).