Changes

Jump to: navigation, search

Widget:AdSense

2,085 bytes removed, 01:42, 20 February 2015
{{Widget|author=Ike Hecht|provider=Google AdSense|providerurl=http://www.google.com/AdSense‎/|addedon=10/3/2013}}{{Comments}}<noinclude>__NOTOC__This widget allows you to add embed '''[http://www.google.com/AdSense‎adsense/ Google AdSenseads] ads to ''' on your wiki page. Ads are placed in specific spots within the page - not in the skin.
== Example ==Created by Ike Hecht for [//www.wikiworks.com WikiWorks].
To insert == Using this widget, ==For information on how to use this widget, see the following code[http://www.mediawikiwidgets.org/AdSense widget description page on MediaWikiWidgets.org].
=== Code from Google ===In Google AdSense, click "Get code". Copy that code. It will look similar to this: <pre><script typeyour site ="text/javascript"><!--google_ad_client = "ca-pub-4602712147397250";/* 160x600To use this widget on your site, created 1just install the [http:/1/10 */google_ad_slot = "6127367636";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="//pagead2www.googlesyndicationmediawiki.comorg/pageadwiki/show_ads.js"></script></pre> === Code in Extension:Widgets MediaWiki Widgets extension] and copy the wiki ===Take the values from above and place them in a widget call, as below.  <nowiki>[{{#widgetfullurl:</nowiki>{{PAGENAMEFULLPAGENAME}}<nowiki>|nameaction=myadname|client=ca-pub-4602712147397250|slot=6127367636|width = 160|height = 600edit}}</nowiki> ==== Parameters ====* '''name''' - The ad name in the AdSense system - full source code] of this is only required for responsive ads* '''client''' - Your AdSense Publisher ID - '''NOTE: It is highly recommended that you hard-code the client ID onto the widget page (Widget:AdSense). Otherwise, users will be able to insert their own ID and make money off of your site.wiki as '''* {{FULLPAGENAME}}'''slot''' - The AdSense Slot ID for this ad* '''width''' - The desired width for this ad* '''height''' - The desired height for this ad == Responsive Example == The Widget was designed to work with responsive ads as well. Usage is similararticle. === Code from Google ===In Google AdSense, click "Get code". Copy that code. It will look similar to this: <pre/noinclude><styleincludeonly>.responsive-1 { width: 320px; height: 50px; }@media(min-width: 500px) { .responsive-1 { width: 468px; height: 60px; } }@media(min-width: 800px) { .responsive-1 { width: 728px; height: 90px; } }</style><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><ins class="adsbygoogle <!-- Responsive 1 {$name|escape:html}--><ins class="adsbygoogle responsive-1" style="display:inline-block;width:<!--{$width|escape:'int'}-->;height:<!--{$height|escape:'int'}-->" data-ad-client="ca<!-pub-4602712147397250{$client|escape:html}-->" data-ad-slot="6127367636<!--{$slot|escape:html}-->"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></pre> === Code in the wiki === ==== CSS ====Take the values from the above <style> section and add the following CSS to your wiki, either by inserting it into your Mediawiki:Common.css, or by adding it to your skin. More info is available [https://www.mediawiki.org/wiki/CSS here].<pre>.responsive-1 { width: 320px; height: 50px; }@media(min-width: 500px) { .responsive-1 { width: 468px; height: 60px; } }@media(min-width: 768px) { .responsive-1 { width: 728px; height: 90px; } }</pre>==== Widget Call ====Take the values from the above <script> section and place them in a widget call, as below.  <nowiki>{{#widget:</nowiki>{{PAGENAME}}<nowiki>|name=responsive-1|client=ca-pub-4602712147397250|slot=6127367636}}</nowiki> <!-- Putting a sample here raises ethical questions. == Sample result =={{#widget:{{PAGENAME}}|param1=|param2=|param3=}}--includeonly>