The CentralNotice extension delivers announcements (usually in the form of banners) to Wikimedia wikis. It is used heavily by the Fundraising team to solicit donations, and for announcements of interest to Wikimedia communities and users. CentralNotice can target announcements by country, language, project, device and logged-in status.
This page has information for CentralNotice developers and wiki administrators who want to install CentralNotice on their own sites. To learn how to create and configure CentralNotice campaigns, please see Help:CentralNotice on Meta-Wiki. For information about the CentralNotice setup on the Wikimedia Foundation's cluster, see CentralNotice on Wikitech.
CentralNotice allows central distribution of announcements to many wikis (called subscribing wikis) from a central wiki (the infrastructure wiki). If you only need to post messages to a single wiki, consider using Sitenotice instead.
InstallationCentralNotice is developed, tested, and known to be deployed only on wikis that do not use table prefixing. If your setup uses table prefixing there is no guarantee this extension will work. Please report any bugs to
Phabricator.
For all wikiswfLoadExtension( 'CentralNotice' );
Geo
cookie is pre-populated, however, its value will be used. For local development, you can enable a client-side implementation that uses https://freegeoip.net as follows. For more information, see #GeoIP lookup.$wgCentralNoticeGeoIPBackgroundLookupModule = 'ext.centralNotice.freegeoipLookup';The infrastructure wiki
php maintenance/run.php update
LocalSettings.php
and set ...
$wgNoticeInfrastructure
to true$wgNoticeProjects
to be an array of projects that will subscribe to the central wiki. For example array( 'wikipedia', 'wiktionary' )
sysop
group is the only group with the ability to administer CentralNotice. If additional groups are needed, assign them the centralnotice-admin
and editinterface
permissions.Edit LocalSettings.php
and set...
$wgNoticeInfrastructure
to false
;$wgNoticeProject
to be an entry in $wgNoticeProjects
;$wgCentralHost
to the protocol (potentially neutral) and domain of the central wiki. For example //meta.wikimedia.org
;$wgCentralSelectedBannerDispatcher
to the URL of Special:BannerLoader on the central wiki, for example: //meta.wikimedia.org/w/index.php/Special:BannerLoader
;$wgCentralDBname
to the name of the infrastructure wiki's database, or $wgCentralNoticeApiUrl
to the API endpoint of the infrastructure wiki; and$wgCentralBannerRecorder
to the URL of Special:RecordImpression on the central wiki. For example: //meta.wikimedia.org/w/index.php/Special:RecordImpression
.For most development tasks, you can use a single wiki in both infrastructure and subscribing roles. Following are sample lines to include in LocalSettings.php
. (See notes in comments.)
wfLoadExtension( 'CentralNotice' ); $wgNoticeInfrastructure = true; $wgNoticeProject = 'centralnoticeproject'; # 'centralnoticeproject' can be any string $wgNoticeProjects = [ $wgNoticeProject ]; $wgCentralHost = $wgServer; $wgCentralSelectedBannerDispatcher = "$wgServer$wgScriptPath/index.php?title=Special:BannerLoader"; $wgCentralDBname = $wgDBname; $wgCentralNoticeGeoIPBackgroundLookupModule = 'ext.centralNotice.freegeoipLookup';
All code that runs on subscribing wikis should be smoke-tested with MobileFrontend , to ensure they work on the mobile version of the site.
DependenciesSome CentralNotice features require other MediaWiki extensions, including EventLogging and Translate .
Getting helpThe WMF Fundraising tech team are the maintainers of CentralNotice. For questions about installation, bug reports, or usage of CentralNotice please send an email to the mailing list wikitech-l@lists.wikimedia.org or join us in the IRC channel #wikimedia-fundraising connect.
Permissionscentralnotice-admin
— Permission required to modify campaigns and banners. Relevant only to the infrastructure wikis (see also bugzilla:26377).
editinterface
- required to edit banner content.From a user facing perspective, the high level CentralNotice objects are campaigns (a.k.a. notices) and banners (a.k.a. templates). These are affected by the back end concepts of selectors and allocation.
By default, CentralNotice has no client-side GeoIP lookup service configured. This is optimised for the Wikimedia Foundation production configuration where Varnish populates the Geo
cookie from the server-side. (See wikitech:Geolocation.) You can configure CentralNotice to use a custom data source client-side through the CentralNoticeGeoIPBackgroundLookupModule
configuration variable. This variable expects the name of a ResourceLoader module that exports a function. The function will be called without parameters and should return a Promise that resolves with an object containing the following properties:
Full usage instructions can be found at meta:Help:CentralNotice.
(TODO: move and expand this snippet)
Add any of the following URL parameters to preview a specific banner, defeat "diet" schemes, or debug pseudorandom banner selection.
?banner=<bannername>
to the end of the URL.
For example,
If there is a problematic banner in the page, you can identify which banner is active by opening your developer console and inspecting the value of: mw.centralNotice.bannerData.bannerName
.
Banners do not display on pages in the Special
namespace, as well as edit pages and diff pages.
CentralNotice adds two API modules, centralnoticechoicedata
and centralnoticequerycampaign
. (The API module centralnoticeallocations was deprecated and removed in MediaWiki 1.25.)
(
main|
centralnoticechoicedata)
Get data needed to choose a banner for a given project and language
Specific parameters:
The project to get banner choice data for.
The language to get banner choice data for.
(
main|
centralnoticequerycampaign)
Get all configuration settings for a campaign.
Specific parameter:
Campaign name. Separate multiple values with a "|" (vertical bar).
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4