Advertising

Placing advertisements or other banners can be useful for wikis, especially small wikis that require advertisements to generate money to offset server costs. Placing advertisements can be challenging to users who do not have an experienced understanding of MediaWiki. Some of the problems include:


 * Needing to find a way of getting the advertisement on every page of the wiki– adding the code manually to each page, possible with a template, would not be effective.
 * Security considerations– Many HTML tags and JavaScript cannot be added to pages, preventing the code from being pasted into single pages or the sitenotice. Enabling such functionality is extremely dangerous and will result in your website being hacked.
 * Keeping the code in a proper place– Someone with knowledge of MediaWiki HTML could add a banner to the relevant skin PHP file, but this would be destroyed during every upgrade. It may also be difficult for someone to know where to place the code.

Vector sidebar

 * https://gist.github.com/Inquisitor-Sasha/6759008

One of the problems with placing advertising in the Vector sidebar is that the sections are collapsible, meaning that many visitors will not see advertisements if they are not properly put it. The problem is that locking a sidebar section open requires technical server side scripting that some users might not want to do. This script places the code of the banner above the title of the section, and displays whether or not the section is expanded.

To use this script, add it to the MediaWiki:Vector.js page and change the referenced ID of the sidebar section to the ID of the section where you want to add the banner.