Extension:Google AdSense/en
This extension is incompatible with MediaWiki 1.39 or any later release! You are advised against using this extension on a live site. Volunteer developers are invited to pledge their efforts to updating this extension to make it compatible with MediaWiki 1.41 by replacing the {{Incompatible }} template with {{Incompatible |version=1.39|pledge=~~~~}} . |
<translate> This extension is currently not actively maintained!</translate> <translate> Although it may still work, any bug reports or feature requests will more than likely be ignored.</translate> <translate> If you are interested in taking on the task of developing and maintaining this extension, [[<tvar name=request>Special:MyLanguage/Gerrit/Privilege policy#Requesting Gerrit privileges</tvar>|you can request repository ownership]].</translate> <translate> As a courtesy, you may want to contact the author.</translate> <translate> You should also remove this template and list yourself as maintaining the extension in the page's <tvar name=extension>{{Extension }}</tvar> infobox.</translate> |
Google AdSense Release status: unmaintained |
|
---|---|
File:Extensions-GoogleAdSense2.png | |
Implementation | Skin , Hook |
Description | Allows to add Google AdSense to the sidebar |
Author(s) | Siebrand Mazeland (Siebrandtalk) |
Maintainer(s) | Zoran Dori |
Latest version | 3.1.0 (2021-01-07) |
MediaWiki | 1.29+ |
PHP | 7.0+ |
Database changes | No |
License | MIT License |
Download | |
|
|
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Translate the Google AdSense extension if it is available at translatewiki.net | |
Issues | Open tasks · Report a bug |
The Google AdSense extension allows to easily add Google AdSense advertisements to the sidebar of your wiki. This extension requires an account with Google's AdSense.
Installing
- <translate> [[<tvar name=2>Special:ExtensionDistributor/GoogleAdSense</tvar>|Download]] and move the extracted <tvar name=name>
GoogleAdSense
</tvar> folder to your <tvar name=ext>extensions/
</tvar> directory.</translate>
<translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/GoogleAdSense - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
wfLoadExtension( 'GoogleAdSense' );
// Replace this with your own publisher ID (google_ad_client / data-ad-client) $wgGoogleAdSenseClient = 'none'; // Client ID for your AdSense script (example: ca-pub-1234546403419693) // Replace this with your AdSense ad unit ID (google_ad_slot / data-ad-slot) $wgGoogleAdSenseSlot = 'none'; // Slot ID for your AdSense script (example: 1234580893)
(You can get your "publisher ID" and "ad unit ID" from the "Get code" page.)
- Add any of the optional settings below - if your settings deviate from the defaults:
// Width of the AdSense unit, specified in your AdSense account (google_ad_width / data-ad-width)
$wgGoogleAdSenseWidth = 120;
// Height of the AdSense unit, specified in your AdSense account (google_ad_height / data-ad-height)
$wgGoogleAdSenseHeight = 240;
// Source URL of the AdSense script. No need to change - it can't deviate from the defaults.
$wgGoogleAdSenseSrc = '//pagead2.googlesyndication.com/pagead/show_ads.js';
// Show the AdSense box only for anonymous users: true or false. Default is false.
$wgGoogleAdSenseAnonOnly = false;
// This can be anything you like. Default is 'none'.
$wgGoogleAdSenseID = 'none';
// Text coding. Default is 'utf8'.
$wgGoogleAdSenseEncoding = "utf8";
// Advertising language. Default is 'en'.
$wgGoogleAdSenseLang = "en";
- 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 default portlet label ("Advertisements") can be changed to "Sponsored Links" on the "MediaWiki:Googleadsense" page. Please note: no other variations are permitted[1].
- Remember to disable ad-blocking services such as AdBlock when you want to see if the extension is working!
- File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>
If you encounter an HTTP 500 error, replace "wfLoadExtension( 'GoogleAdSense' );" with "require_once "$IP/extensions/GoogleAdSense/GoogleAdSense.php";".
See also
- Widget for Google AdSense display within wiki pages (not within the skin)
- ShoutWiki Ads
- WimaAdvertising
- PCR GUI Inserts
References
- ↑ AdSense Help: Ad placement policies: Placing ads under a misleading header
- Pages with script errors
- Pages with broken file links
- Extensions incompatible with 1.39/en
- Unmaintained extensions/en
- Skin extensions/en
- Hook extensions/en
- Extensions with manual MediaWiki version
- MIT licensed extensions/en
- Extensions in Wikimedia version control/en
- All extensions/en
- Extensions not in ExtensionJson
- Advertising extensions/en
- Google extensions/en