Collect cookie consent
The legal.js cookie-consent widget is under heavy development. It currently supports analytical, marketing, and necessary cookies; support for other categories will be added in future.
Integration
This guide assumes that you have successfully created your cookie-widget in the Openli app, and have its JavaScript snippet ready to integrate.
Adding the cookie-consent widget to your site
To collect cookie-consent with legal.js, you must embed the widget using its generated JavaScript snippet.
The snippet must be included immediately before the closing-tag of the body
element, like this:
If you are unable to do this, you must ensure that the call to legal.widget(...)
occurs after the DOM is ready, using a combination of the DOMContentLoaded
event and the document.readyState
property. This reference article provides a good overview of the events involved. Contact us if you are in doubt.
Next steps
Last updated