Extension:Google AdSense 2

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
Google AdSense

Release status: stable

Extensions-GoogleAdSense2.png
Implementation Skin
Description Allows to add Google AdSense to the sidebar
Author(s) Siebrand Mazeland (Siebrandtalk)
Latest version 2.1 (2012-08-17)
MediaWiki 1.18+
Database changes No
License MIT
Download
Parameters
  • $wgGoogleAdSenseClient
  • $wgGoogleAdSenseSlot
  • $wgGoogleAdSenseID
  • $wgGoogleAdSenseWidth
  • $wgGoogleAdSenseHeight
  • $wgGoogleAdSenseSrc
  • $wgGoogleAdSenseAnonOnly
Hooks used
SkinBuildSidebar

Translate the Google AdSense 2 extension if possible

Check usage and version matrix; code metrics

The Google AdSense 2 extension allows the easy addition of Google AdSense advertisements to a MediaWiki instance. See screenshot and Installation for details. This extension requires an account with Google's AdSense.

Installation[edit | edit source]

  • Download the extension
  • Add the following lines to your LocalSettings.php (replace the text where directed), putting any $wgGoogle... globals after the require_once statement:
require_once( "$IP/extensions/GoogleAdSense/GoogleAdSense.php" );
$wgGoogleAdSenseClient = 'replace this with the client name';
$wgGoogleAdSenseSlot = 'replace this with the slot name';
$wgGoogleAdSenseID = 'replace this with your ID';

Example settings

$wgGoogleAdSenseClient = 'pub-8330046405419293';
$wgGoogleAdSenseSlot = '1640430293';
$wgGoogleAdSenseID = 'yourwiki-2';
  • Add any of the optional settings below, if your settings deviate from the defaults
// Width of the AdSense box, specified in your AdSense account
$wgGoogleAdSenseWidth  = 120;
// Height of the AdSense box, specified in your AdSense account
$wgGoogleAdSenseHeight = 240;
// Source URL of the AdSense script
$wgGoogleAdSenseSrc    = "http://pagead2.googlesyndication.com/pagead/show_ads.js";
// Show the AdSense box only for anonymous users
$wgGoogleAdSenseAnonOnly = true;
  • If you want to add a "Text/image, 200x200" into the vector skin you will need to shift the left panel over slightly. Add the following to the MediaWiki:Vector.css page
#content, #footer { margin-left: 11em; }
#left-navigation  { left: 11em; }
  • The description (label) of the portlet can be changed in [[MediaWiki:Googleadsense]]. Defaults to "Google AdSense".

See also[edit | edit source]