扩展:Google广告
Appearance
![]() | 此扩展与MediaWiki 1.39或更高的版本不兼容! 建议您不要在正常运行的网站上使用此扩展。 我们邀请志愿开发者将 {{Incompatible }} 模板替换为{{Incompatible |version=1.39|pledge=~~~~}} 來承諾更新此扩展使其与MediaWiki 1.43兼容。 |
![]() | 此扩展目前不再積極维护! 尽管它可能仍然工作,但任何错误报告或功能请求将很可能被忽略。 如果您对承担开发与维护该扩展的任务工作感兴趣,您可以请求自己的存储库。 作为礼貌,您或许可以联络作者。 或者您应移除该模板,并在页面的{{Extension }}信息框中将您自己列为扩展的维护人员。 |
![]() 发行状态: 不再維護 |
|
---|---|
![]() |
|
实现 | 皮肤 , 函数钩 |
描述 | 允许你的网站把 AdSense 广告加入侧边栏 |
作者 | Siebrand Mazeland (Siebrand留言) |
维护者 | Zoran Dori |
最新版本 | 3.1.0 (2021-01-07) |
MediaWiki | 1.29+ |
PHP | 7.0+ |
数据库更改 | 否 |
许可协议 | MIT授權條款 |
下載 | |
|
|
前往translatewiki.net翻譯Google AdSense扩展 | |
問題 | 开启的任务 · 报告错误 |
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.
安裝
- 下载文件,并将解压后的
GoogleAdSense
文件夹移动到extensions/
目录中。
开发者和代码贡献人员应从Git安装扩展,输入:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/GoogleAdSense - 将下列代码放置在您的LocalSettings.php 的底部:
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!
完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。
If you encounter an HTTP 500 error, replace "wfLoadExtension( 'GoogleAdSense' );" with "require_once "$IP/extensions/GoogleAdSense/GoogleAdSense.php";".
參見
- Widget for Google AdSense display within wiki pages (not within the skin)
- ShoutWiki Ads
- WimaAdvertising
- PCR GUI Inserts
參考資料
- ↑ AdSense Help: Ad placement policies: Placing ads under a misleading header