Release status: stable
|Latest version||0.3.0 (February 2021)|
|Translate the CookieWarning extension if it is available at translatewiki.net|
|Issues||Open tasks · Report a bug|
This extension was merged with the former CookiePolicy extension, which provided a similar functionality and was originally written by Liz Lee for Wikia and further cleaned up and enhanced by Jack Phoenix for ShoutWiki.
- Download and place the file(s) in a directory called
- Add the following code at the bottom of your LocalSettings.php:
wfLoadExtension( 'CookieWarning' );
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
After the successful installation of CookieWarning, you need to enable it with the configuration option
$wgCookieWarningMoreUrl, which simply takes the URL of the page (full or relative, but relative may not work, if you use subpages in your wiki!). Alternatively you can set
There're some other configurations, that can help you to target the correct users with the cookie information bar. The the following table contains all possible options.
||You have to set this variable to 'true' to make the extension work.|
||Set the URL to your 'More Information' page.|
||An IP location service, which takes the IP address of the visitor and returns a JSON string that complies to the freegeoip.net schema (example). CAUTION: If the geo-targeting is enabled, the IP address of your users will be directly (NOT anonymized!) sent to the service configured in this option, which may be a problem in some countries or jurisdictions.|
||When and how do you want that the wiki tries to locate the user. Possible values:
||The list of regions, which users should see the cookie notification bar.|
If you would like to change the text of the messages shown navigate to the following pages and adjust as required:
Migrating from CookiePolicy extension
In October 2016, the CookiePolicy extension was merged into the CookieWarning extension, as both tried to solve the same problem. The following sections will give you the information, what you need to do to migrate CookiePolicy to CookieWarning.
[[MediaWiki:Cookie-policy-link]] interface message will be observed by CookieWarning, too, so you can use your customization of the message shown to the user with CookieWarning, too. However, as this is just for backwards compatibility reasons, it's strongly recommended to change to the CookieWarning message
[[MediaWiki:Cookiewarning-more-link]], e.g. by moving the page on your wiki, or using the configuration option
$wgCookieWarningMoreUrl to configure the target link.
The logic to locate an user used in CookiePolicy was merged into CookieWarning. However you need to configure some things to enable it by setting the following options into your
$wgCookieWarningEnabled = true; $wgCookieWarningGeoIPLookup = 'js';
$wgCookiePolicyGeoIPServiceURL configuration option is named
$wgCookieWarningGeoIPServiceURL in CookieWarning, you need to change it in your LocalSettings.php, if you use it.
It's too simple! I need help! (aka I found a bug, what should I do?)
You can always request help and report problems on the talk page or at Phabricator.