Widget
Openli provides you with an easy and straightforward approach to collect and manage consent. We have a few widgets that do just that!
Setup
The legal.js widget library requires a small snippet of JavaScript code to be included once in each page you use it on. This snippet is available in your account's Widgets section, and looks like this:
Whenever possible, you should include the snippet as the first script in your page's <head>
section:
What's next?
When you have legal.js loaded, you can begin to use its functionality to collect consents, show your legal agreements, and update user-data.
General widget options
Identify a known user
Openli gives you the ability to identify your users more precisely using a unique value that your internal system already associates with them. Identifying a user this way allow us to be certain who the user is, and not to rely on cookies, which the user can change or delete.
To do this, You can provide thelegal.widget()
method with a value for the identifier
option.
Here is an example of identifying your user when initializing a widget:
In the above example, <<USER ID>>
is what you will substitute with your unique identifier for the user.
We recommend using database IDs because they tend to remain consistent over time. This helps to ensure that you can still recognize the same user in all of your analytics tools even though the user's other details might change.
Set the widget language
To set the display language, initialise your widget with the locale
option set to the value for the language you desire. For example, to use Danish when the jurisdiction is Denmark, your widget's initialisation would look similar to this:
English is the default language, and supported languages are listed below.
If you do not specify a language, or if the language you set is not supported by us in the visitor's jurisdiction, English will be used. The table below lists the supported combinations.
Language | Supported in jurisdiction | Option value |
English (EN) | All jurisdictions | None, or |
Danish (DA) | Denmark (DK) |
|
Dutch (NL) | Netherlands (NL) |
|
English (EN) | Great Britain (GB) |
|
English (EN) | United States (US) |
|
French (FR) | France (FR) |
|
German (DE) | Austria (AT) |
|
German (DE) | Germany (DE) |
|
Norwegian (NO) | Norway (NO) |
|
Swedish (SV) | Sweden (SE) |
|
Last updated