We discuss how to run and deliver ads to a MediaWiki site, whether ads are good or bad, how to choose the right ad network, and what requirements may apply to placing and formatting ads on a wiki page.
Many of us likely view website advertising merely as a straightforward means of generating revenue. However, it could be a matter of viewpoint. Below are some arguments supporting and opposing advertising:
Pros:
Cons:
The truth is that, in most cases, MediaWiki users come to the wiki for purposes quite different from getting ads. On the other hand, depending on the subject matter of the wiki, targeted and content-relevant advertising can help readers move to a purchase after getting the necessary information about the product (character, place, lifestyle, etc.) from the wiki article.
You should be aware that many users use ad-blocking software to avoid seeing ads, which can reduce the effectiveness of advertising on a site. For example, the Adblock Plus extension for Google Chrome has over 10 million users, and there are a lot more similar extensions for all major browsers.
Thus, in general, the decision to advertise on a MediaWiki site will depend on the goals of the site owner and their willingness to balance revenue potential with user experience.
Here is a basic workflow on how to choose the right ad network and ad format for your MediaWiki site:
There are several criteria to consider when choosing an ad network for your MediaWiki site. Here are some tips to help you make an informed decision:
With these criteria in mind, you can choose the ad network that suits your goals and offers the best revenue potential for your MediaWiki site.
It's difficult to provide a comprehensive overview of the niche and audience of each of the biggest advertising networks since they often have a broad reach and cater to various niches, and offer a variety of ad formats, including display ads, text ads, native ads, etc. However, here's a brief overview:
It's worth noting that these advertising networks are constantly evolving and expanding their reach and polishing targeting algorithms to show ads to users based on their interests and behavior. It's important to research each network and determine which one aligns with your MediaWiki site's niche and audience.
If no network has convinced you, or if monetization is not your main goal, there is an option to run self-advertising. In this case, you are in charge of selling your advertising services by placing and rotating ads directly on your wiki.
Once you've decided on an ad network, you must sign up for an account and follow the steps to get approved. Once approved, you will generate an advertising code for your MediaWiki site. This usually includes choosing the format and size of the ad.
The tools may vary across networks, but the result will be the same: an embed code to serve ads with the selected parameters.
There are a number of extensions available for MediaWiki, but most are either unmaintained or only support a limited number of Mediawiki skins or ad sources. The four extensions that are “stable” as of April 2023 and support at least one of Google AdSense and self-hosted ads are compared in the table below.
Extension | Google AdSense | Self-hosted ads | Number of ad banner locations |
Google AdSense | Yes | No | 1 |
ShoutWiki Ads | Yes | No | 1 or more |
WikidataPageBanner | No | Yes | 1 |
WimaAdvertising | Yes | Yes | 1-4 |
Either way, using extensions can be very restrictive, pushing you towards an ad network or skin choice. Apart from this, extensions suffer from the common issues with the MediaWiki extensions: they can become poorly maintained, outdated or obsolete. The placement of your ads into the skin elements may require some coding, sometimes complex.
Placing advertisements can be challenging to users who do not have an experienced understanding of MediaWiki. Some of the challenges may include:
Therefore we will fill the gap and explain the ads delivery at the lower level, focusing on network ads embedding into the editable areas of your MediaWiki using system messages and plain HTML / JavaScript provided in the generated code.
A system message is a snippet of plain text (), wikitext, CSS, or JavaScript that can be used to customize the behavior of MediaWiki and its appearance for each language and locale. For example, you can see the codenames of all system messages defining the interface elements by adding uselang=qqx
parameter to the URL:
You can see the system message codenames in round brackets. There is a page in the MediaWiki namespace corresponding to each system message. For example, to edit the search bar placeholder, you are supposed to edit MediaWiki:searchsuggest-search
page:
Luckily, the whole MediaWiki namespace editing requires special editinterface
permission: it makes it a safe place for embedding your ad code.
As we don’t want to break any existing system message, we’ll use the extension PageNotice that creates four areas editable via specific system messages:
MediaWiki:top-notice-XXX
MediaWiki:bottom-notice-XXX
MediaWiki:top-notice-ns-NNN
(where NNN is the numeric namespace ID)MediaWiki:bottom-notice-ns-NNN
(where NNN is the numeric namespace ID)It means that you will be potentially able to display ads separately by namespaces or even bring specific ads to given pages.
The generated ad network code is usually a mix of arbitrary HTML, CSS, and Javascript. Since MediaWiki allows only certain HTML tags, we’ll use a separate namespace offered by the Widgets extension. The Widget namespace is good for embedded ads code hosting as it is editable only under a special user right (editwidgets
).
There is a collection of widgets on MediaWikiWidgets.org, including the AdSense widget by Ike Hecht.
Make sure that you have Widgets and PageNotice installed, your user account has got the editinterface
and editwidgets
permissions and proceed to building your ads mechanics.
Note: Registration and login with a valid email are required to access the widget code and examples.
Step 1. Copy the AdSense widget code and save it on the page Widget:AdSense
of your wiki.
Step 2. In Google AdSense, click "Get code". Copy that code. It will look similar to this:
Step 3. To display ads in the top notice area for the main namespace, place the following code on the page MediaWiki:Top-notice-ns-0
, passing the values taken from the Google AdSense code:
{{#widget:AdSense |client=ca-pub-0000000000000000 |slot=00000000000 |width=160 |height=600 }}
Save the page. You are done!
More examples and hints you can find on the widget page.
Once you have completed all the steps:
If you opted to continue on your own please make sure you are familiar with the “Ads placing policies” by Google. You will learn what practice and approaches are considered bad:
For a professional looking integration of ads into your current skin and maximizing your revenue potential, do not hesitate contacting professionals. We are here to answer any of your MediaWiki questions and professional MediaWiki help, training, maintenance, and hosting services. You can find additional MediaWiki related articles on our blog.
Here’s what we've been up to recently.
Knowledge management is the art and science of turning organizational know-how into a valuable, shared resource. It ensures that insights don’t remain locked in individual minds or scattered files, but instead become accessible, reusable, and continuously improved. As a result, teams can make better decisions, solve problems faster, and drive sustainable innovation.
Struggling with knowledge management in your organization? Our latest blog, Overcoming Knowledge Management Challenges: Strategies for Success, is here to help! From breaking down silos to ensuring up-to-date, accessible information, we explore common hurdles and provide actionable strategies to enhance your KM practices. Discover how you can foster a knowledge-sharing culture, improve accessibility, and measure the impact of KM initiatives to drive organizational success.
Get our latest blogs and news delivered straight to your inbox.
We use cookies to provide and improve our services. By using our site, you consent to cookies.
Learn more