Changes

Jump to: navigation, search

Widget:AdSense

2,069 bytes added, 01:35, 20 February 2015
<noinclude>__NOTOC__{{Widget|author=Ike Hecht|provider=Google AdSense|providerurl=http://www.google.com/AdSense‎/|addedon=10/3/2013}}{{Comments}}This widget allows you to embed '''add [http://www.google.com/adsenseAdSense‎/ Google AdSense ads]''' on ads to your wiki page. Ads are placed in specific spots within the page - not in the skin.
Created by Ike Hecht for [//www.wikiworks.com WikiWorks].== Example ==
== Using To insert this widget ==For information on how to , use this widget, see the [httpfollowing code://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 your site this: <pre><script type="text/javascript"><!--google_ad_client ="ca-pub-4602712147397250";To use this widget on your site/* 160x600, just install the [http:created 1/1/10 */google_ad_slot = "6127367636";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="//wwwpagead2.mediawikigooglesyndication.orgcom/wikipagead/Extension:Widgets MediaWiki Widgets extension] and copy the [{{fullurl:{{FULLPAGENAME}}|action=edit}} full source code] of this page to your wiki as '''{{FULLPAGENAME}}''' articleshow_ads.js"></noincludescript><includeonly/pre=== Code in the wiki ===Take the values from above and place them in a widget call, as below.  <nowiki>{{#widget:AdSense</nowiki>{{PAGENAME}}<nowiki>|name=myadname|client=ca-pub-47858072580580794602712147397250
|slot=6127367636
|width = 160
|height = 90600}}</nowiki> ==== Parameters ====* '''name''' - The ad name in the AdSense system - 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.'''* '''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 similar. === Code from Google ===In Google AdSense, click "Get code". Copy that code. It will look similar to this: <pre><style>.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><!-- AS1 Responsive 1 --><ins class="adsbygoogleresponsive-1" style="display:inline-block;width:160px;height:90px" data-ad-client="ca-pub-47858072580580794602712147397250" data-ad-slot="14323699486127367636"></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=}}-->