Technical Reference
This article lists the technical names used by Lightweight Cookie Notice: cookies, browser storage, CSS classes and IDs, files, and requests. Use it when you configure a caching plugin, a firewall, Google Tag Manager, or custom code.
The free and the Pro version use different prefixes: daextlwcnf in the free version and daextlwcn in the Pro version.
Cookies set by the plugin
| Purpose | Free | Pro | Value |
|---|---|---|---|
| The visitor made a choice | daextlwcnf-accepted | daextlwcn-accepted | 1 |
| State of each category | daextlwcnf-category-status | daextlwcn-category-status | A JSON list, see below |
| Key of the consent record | daextlwcnf-encrypted-key | daextlwcn-encrypted-key | A SHA-512 hash |
| Notice disabled by geolocation | daextlwcnf-cn-disabled | daextlwcn-cn-disabled | 1 |
Notes:
- The acceptance cookie is set when the visitor accepts or rejects. It means “a choice was made”, not “the cookies were accepted”. The accepted categories are in the category state cookie.
- The cookie that marks the notice as disabled is set only with geolocation on and the Disable cookie notice and enable all cookie categories behavior, for visitors outside the selected countries.
- The lifetime of all the cookies is set with Expiration, their path with Path, and, in the Pro version, their domain with Domain. See Advanced Settings Reference.
- The cookies are created with JavaScript in the visitor’s browser.
Format of the category state cookie
The value is a JSON list with one item per category. categoryId is the ID of the category, and status is 1 when the category is enabled and 0 when it is disabled.
[{"categoryId":"1","status":"1"},{"categoryId":"2","status":"0"}]
The ID of a category is the number after edit_id= in the address of its edit page in Cookie Notice → Categories.
Read the consent in your own JavaScript
This function returns true when the category with the given ID is enabled. The example uses the cookie of the Pro version. For the free version, replace daextlwcn-category-status with daextlwcnf-category-status.
function lwcnCategoryEnabled(categoryId) {
var match = document.cookie.match(/(?:^|; )daextlwcn-category-status=([^;]*)/);
if (!match) {
return false;
}
try {
var states = JSON.parse(decodeURIComponent(match[1]));
return states.some(function (state) {
return String(state.categoryId) === String(categoryId) && String(state.status) === '1';
});
} catch (error) {
return false;
}
}
if (lwcnCategoryEnabled(2)) {
// The category with ID 2 is enabled.
}
You can use the same logic in a custom JavaScript variable of Google Tag Manager to fire tags based on the enabled categories.
Browser local storage
| Key | Version | Content |
|---|---|---|
daextlwcnf_country_code | Free | The country code detected by the geolocation. |
daextlwcn_country_code | Pro | The country code detected by the geolocation. |
consentGranted | Pro | Set to true when Google Consent Mode is on and the visitor has granted at least one consent mode parameter. It is not removed when the visitor revisits the consent. |
CSS classes and IDs
Replace daextlwcn with daextlwcnf for the free version.
| Element | Selector (Pro) |
|---|---|
| Cookie notice | #daextlwcn-cookie-notice-container |
| Mask of the cookie notice | #daextlwcn-cookie-notice-container-mask |
| Notice buttons | #daextlwcn-cookie-notice-button-1, #daextlwcn-cookie-notice-button-2, #daextlwcn-cookie-notice-button-3, #daextlwcn-cookie-notice-button-dismiss |
| Cookie settings window | #daextlwcn-cookie-settings-container |
| Cookie settings buttons | #daextlwcn-cookie-settings-button-1, #daextlwcn-cookie-settings-button-2 |
| Revisit consent button | #daextlwcn-revisit-cookie-consent-container |
| Custom revisit consent trigger | .daextlwcn-revisit-consent-trigger |
| Marker of available consent data | .daextlwcn-consent-data-available |
| Cookie table of the block and shortcode (Pro) | .daextlwcn-list |
| Delete Cookies button (Pro) | #daextlwcn-clear-cookies |
| Revisit Consent block button (Pro) | #daextlwcn-revisit-consent-button |
An element with the “marker of available consent data” class is present in the page when the choice of the visitor is available: inside the revisit consent button, and for a short moment when the notice is disabled by geolocation. It can be used as a condition in tag managers.
Shortcodes (Pro)
| Shortcode | Attributes |
|---|---|
[cookies] | category-id (optional): the ID of a category |
[delete-cookies] | None |
[revisit-consent] | None |
Front-end files
With Assets Mode set to Production, the plugin loads one JavaScript file in the footer:
| Version | File |
|---|---|
| Free | /wp-content/plugins/lightweight-cookie-notice-free/public/assets/js/production/general.js |
| Pro | /wp-content/plugins/lightweight-cookie-notice/public/assets/js/production/general.js |
The plugin also prints a small inline script in the footer that starts the notice with your settings. The plugin does not load CSS files: the styles are generated by the JavaScript file.
With Assets Mode set to Development, the plugin loads five separate non-minified files from the public/assets/js/ folder instead of general.js.
Requests made by visitors’ browsers
If you use a firewall or a security plugin, allow these requests for visitors who are not logged in.
| Request | Free | Pro | Used for |
|---|---|---|---|
| REST API route | /wp-json/lightweight-cookie-notice-free/v1/nonce/ | /wp-json/lightweight-cookie-notice-pro/v1/nonce/ | Saving the consent, geolocation |
admin-ajax.php action | daextlwcnf_save_consent_log | daextlwcn_save_consent_log | Saving the consent in the Consent Log |
admin-ajax.php action | daextlwcnf_geolocate_user | daextlwcn_geolocate_user | Geolocation with MaxMind GeoLite2 |
External services
| Service | When it is contacted |
|---|---|
Google Fonts (fonts.googleapis.com) | By visitors’ browsers, when Google Fonts Embed Code URL is not empty. This is the default. |
HostIP.info (api.hostip.info) | By visitors’ browsers, when Geolocation is on with the HostIP.info service. |
Google Tag Manager (www.googletagmanager.com) | By visitors’ browsers, in the Pro version, when Google Consent Mode is on, a container ID is set, and the visitor has granted at least one consent mode parameter. |
DAEXT (daext.com) | By your server, in the Pro version, to verify the license and check for updates. |
Database tables
{prefix} is the table prefix of your WordPress installation, for example wp_.
| Content | Free | Pro |
|---|---|---|
| Sections | {prefix}daextlwcnf_section | {prefix}daextlwcn_section |
| Categories | {prefix}daextlwcnf_category | {prefix}daextlwcn_category |
| Cookies | {prefix}daextlwcnf_cookie | {prefix}daextlwcn_cookie |
| Consent log | {prefix}daextlwcnf_consent_log | {prefix}daextlwcn_consent_log |
The tables and the options of the plugin are removed when you delete the plugin from the Plugins menu.
Text domains
| Version | Text domain |
|---|---|
| Free | lightweight-cookie-notice-free |
| Pro | lightweight-cookie-notice |
Requirements
| Version | WordPress | PHP |
|---|---|---|
| Free | 5.0 or later | 7.3 or later |
| Pro | 6.3 or later | 8.1 or later |
Credits
The plugin includes these third-party components:
| Component | License |
|---|---|
| Select2 | MIT License |
| Composer | MIT License |
| JShrink | BSD 3-Clause License |
| GeoIP2 PHP API | Apache License 2.0 |
| MaxMind DB Reader PHP API | Apache License 2.0 |
| Common Code for MaxMind Web Service Clients | Apache License 2.0 |
| jsPDF (Pro) | MIT License |
This product may include GeoLite2 data created by MaxMind, available from https://www.maxmind.com.