Advertising with Redmine¶
- Advertising with Redmine
The plugin adds advetisements having title, text and optional image to the side bar. Advertisements are shown based on keywords found in the page content (project description, issue description, last comments etc), on languages provided by the browser (which provides languages the user understands), projects (administrators can specify, for which projects an advertisement should be shown or not) and on “hits” (the plugin tries to show advertisements with smaller hits number). Advertisements can be accessed using the special top menu item “Advertisements”. To edit advertisements the user must have the special “Manage advertisements” permission.
The plugin’s internal name is “reklama”...
Before “Reklama” the name was “Advertisements” but when used with other plugins, which put their data into the side bar, an advertisement was shown first. So the name was changed to “Reklama” to move advertisements down.
The plugin adds the top menu item “Advertisements”, which allows managing advertisements. To access this item the user must have the “Manage advertisements” permission (administrators do not need this permission).
This menu item opens the list of advertisements:
The special link “Clear hits” allows to zero hits for all advertisements.
The advertisement editing form looks like this:
Some notes about the form:
- Heading, content and language fields are required;
- There can be only one image attached;
But you can link to other images from the Wiki content.
- Language field holds the language of the advertisement;
- Keywords should be latin characters only;
- Keywords are specified one keyword per input field;
- Strict mode means, that the advertisement is to be shown only for pages having the specified keywords (at least one of them);
- An advertisement is to be shown only for projects checked in the form.
How it works?¶
The plugin uses the following algorithm to fetch an advertisement:
- Tries to find adveretisements by keywords, keywords are extracted from the page content;
For project this is the project description, for issue this is the issue description, for Wiki page this is the page content and so on.
- If fails, uses all advertisements;
- Filters out advertisements, which should not be shown for the project;
- Filters out disabled advertisements;
- Filters out advertisements in languages not known to the user (based on data provided by the browser);
- If advertisements were found by keywords, selects the advertisement with the largest number of keywords and with the smallest number of hits;
- Otherwise selects an advertisement with just the smallest number of hits.
- If a page contains keywords advertisements with these keywords will be shown (even if there will be an advertisement with zero hits);
- The plugin tries to show each advertisement equal number of times (hits).
The Reklama plugin requires RMagick.
To install the plugin:
- For Redmine 2.x.x and above:
rake redmine:plugins:migrate RAILS_ENV=production.
- For older Redmine and ChiliProject:
rake db:migrate:plugins RAILS_ENV=production.
- Restart Redmine/ChiliProject.
The Advertising plugin can provide custom CSS rules for Redmine themes.
Right now this feature is used to:
- Add the top menu icon for the Advertisements menu item to the Classic Redmine theme.
- Make advertisements in the list look like they were on the sidebar for the Red-Andy.
Check also this page for instructions on how to add support for other Redmine themes.