Extension talk:Google AdSense/Archive

google adsense polices

Is there a way to prevent the ads from displaying on "non-content" pages, so I can comply with Google's policies?--Long

Javascript error

I'm getting a javascript error:

Invalid Character show_ads.js URI: [...]/pagead/show_ads.js

What is it?

remove the 'google adsense' text outside the box

hi, i use this extension on my website www.klusopedia.nl and it works great. thanks for that! i have one small question, how can i remove or at least change the google adsense text that is just above the box. This is bugging me a bit since it already says google ads standard withing the box. Thanks! RT

Found a way to do this effectively. This workaround is for the Monobook skin. Open the file /skins/MonoBook.php
Find
		<h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5>
replace with
		<h5><?php //mod to remove adsense label ******************
				if( stristr($bar, 'google') === FALSE ) {
					$out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; 
				}
		?></h5>
rareindianart wiki , 27 April , 2010

is there an extension for google ad links in the footer?

i once saw a website that had google ad links on every page in the footer. does anyone know of such an extension? Would be great to complement on this one!

Different placement for ads

Is it possible to add the option to show the ads like this? (above & below page content).--Alnokta 18:37, 14 October 2008 (UTC)Reply

I think other Google AdSense extensions allow that type of behaviour. This extension however, was specifically designed to add AdSense but do it as unobtrusive as possible. Siebrand 00:26, 17 November 2008 (UTC)Reply
Can it be placed on the top of the sidebar (under the logo)? Thank you! Coulomb 02:44, 13 March 2009 (UTC)Reply
I wish... I can't even implement banner ads this way, I'm keeping my fingers crossed to get a column ad working.(bodykitwiki)

Usergroups

Can this extension be restricted to only show ads to guests? --Resplendent 17:22, 29 October 2008 (UTC)Reply

Not without a change in the code. I'd be happy to apply a patch if you make it configurable with a global like $wgGoogleAdSenseAnonOnly, default set to false. Siebrand 00:24, 17 November 2008 (UTC)Reply
hi, im another user and I would really love that sort of feature. 203.122.240.118 10:17, 24 November 2008 (UTC)Reply
Can now $wgGoogleAdSenseAnonOnly = true; to only show it to anonymous users. Siebrand 01:19, 27 November 2008 (UTC)Reply
  • I just installed this extension on my wiki at debatrix.org and it looks great. I have two questions though;
  1. How can I hide the ads for sysops users?
  2. Is there a way to prevent the ads from displaying on "non-content" pages, so I can comply with Google's policies?--Jake4d 18:18, 12 April 2009 (UTC)Reply
1. In GoogleAdSense.class.php, after
		if( $wgUser->isLoggedIn() && $wgGoogleAdSenseAnonOnly ) {
			return $bar;
		}

add

		if( array_key_exists("sysop", $wgUser->getGroups() ) ) {
			return $bar;
		}
2. That'd take more work. Go bug Siebrand. :D
Emufarmers(T|C) 00:34, 13 April 2009 (UTC)Reply
  • I added the code to GoogleAdSense.class.php, but I still have ads when I am logged in as sysops. Do I need to add a line to my LocalStettings.php for this to work?--Jake4d 05:31, 13 April 2009 (UTC) NOTE: I just upgraded to v1.14 will this make a difference?Reply
Sorry, that should be
		if( in_array( 'sysop', $wgUser->getGroups() ) ) {
			return $bar;
		}
Emufarmers(T|C) 06:14, 13 April 2009 (UTC)Reply

Sample Data Request

I am new to Google Adsense. Sorry if this is a dumb question. For the client name, is that my name? For the AdSense Slot, I am assume that is the number associated with the ad and the AdSenseID starts with pub-?

Thanks.

See example config below as we use it on translatewiki.net. siebrand 22:17, 5 January 2009 (UTC)Reply
require_once( "$IP/extensions/GoogleAdSense/GoogleAdSense.php" );
$wgGoogleAdSenseClient = 'pub-8440046403419693';
$wgGoogleAdSenseSlot = '9240280893';
$wgGoogleAdSenseID = 'translatewiki-2';

AdSense Client and AdSense ID

This extension currently isn't working for me. I logged out, cleared my cache and refreshed but the ads don't show up. I'm not entirely sure if I have the AdSense Client and AdSense id correct. Your AdSense client should be pub-XXXXXXXXXXXXXXXX, but what should your id be? The same format? Or where can I find this number?

In your adsense account you can find the HTML/JS to add to your page. You can extract the required text from there. See above for a working config example. siebrand 19:01, 3 February 2009 (UTC)Reply


Info on finding the Adsense ID is found here in the google forums: Google Forum- Adsense ID

this is useless as the link says "Also known as Publisher ID". In this case they are different.

Stumped

I've looked though my HTML/JS bit on AdSense but still unsure what it means by the ID...I've got the client and slot sorted no problem...Just the ID doesn't make sense to me (Sorry for being dumb)--Satire3rd 08:55, 9 February 2009 (UTC)Reply

The ID is somewhere in your AdSense account. This is the ID of profile for your AdSense format (in which you configured colours, and other stuff). siebrand 17:53, 9 February 2009 (UTC)Reply
Here is the difference between the extension terminology, and Google AdSense terminology;
$wgGoogleAdSenseClient = 'pub-0207020468051527'; google_ad_client = "pub-0207020468051527";
$wgGoogleAdSenseSlot = '8954041352'; google_ad_slot = "9620774675";
$wgGoogleAdSenseID = 'debatrix'; Your website name (example is for my site)

--Jake4d 07:13, 13 April 2009 (UTC)Reply

Still $wgGoogleAdSenseID: I too had quite a bit of time to spend until I found out that you just use the URL you have provided to Google AdSense at subscription, like www.mysite.com for the $wgGoogleAdSenseID. --Horst Salzwedel 06:26, 26 August 2009 (UTC)Reply
So does anyone know the actual answer. It can't the url you provided to Google at subscription, as you can have multiple domains and sites but only use one adsense account. Like I could've used Acme.Com to establish the adsense account, but if I want to put ads on RoadRunner.com, I don't open another adsense account, I use the same one. Could the ID be the name of the ad unit?


Ad width: And another hint to save some time for others: the width of the ads should be 120 px (either x 240 or 600 in height) in order to fit under the boxes on the left side. --Horst Salzwedel 06:26, 26 August 2009 (UTC)Reply

I found that I had to go into the extensions folder and change the script there from 240 to 600, to get the ads to show up.

Doesn't work on my website

I download "GoogleAdSense.class.php", "GoogleAdSense.i18n.php", and "GoogleAdSense.php" and I put them under the "extensions\GoogleAdSense" folder. But it doesn't work. Is it because of the ID? I think ID is something you create when acquiring the AdSense code from google, right? Any idea? Thank you! Coulomb 10:15, 16 February 2009 (UTC)Reply

See topic immediately above this one. siebrand 10:47, 16 February 2009 (UTC)Reply
See https://www.google.com/adsense/adslots . The name is in the first colomn. siebrand 10:49, 16 February 2009 (UTC)Reply
I think I got the right ID. I put $wgGoogleAdSenseClient, $wgGoogleAdSenseSlot, and, $wgGoogleAdSenseID on both my LocalSetting.php and GoogleAdSense.php. However, it still doesn't appear on my web page. Is the $wgGoogleAdSenseSrc the same for everyone? Or should I change it? Thank you. Coulomb 23:07, 17 February 2009 (UTC)Reply
What MediaWiki version are you using? siebrand 08:00, 19 February 2009 (UTC)Reply
My version is 1.13.2. After modifing the skin.php file, this extension works! Thank you so much!Coulomb 20:35, 11 March 2009 (UTC)Reply

Perhaps newer versions don't work?

I'm on version 1.13.4. Is this perhaps the reason it does not work? Thanks

See the extension description. 1.14alpha or newer :) . Use 1.14.0rc1 for example--DaSch 07:47, 20 February 2009 (UTC)Reply
Sorry don't know what that means. Is there a link. I've only just installed wikimedia
Waht about thisdownload:mediawiki/1.14/mediawiki-1.14.0rc1.tar.gz--DaSch 11:56, 20 February 2009 (UTC)Reply
Download link for MediaWiki 1.14 RC1. siebrand 11:57, 20 February 2009 (UTC)Reply
Do you have to put the ID in both Localsettings.php and the GoogleAdSense.php extension file?--76.71.113.134 01:13, 26 February 2009 (UTC)Reply
No: you should only make changes in LocalSetteings.php. —Emufarmers(T|C) 09:47, 26 February 2009 (UTC)Reply

A fix for older versions e.g. Media Wiki 1.13.2

Check your version by checking Special:Version page If you have an older version, update last few lines of the includes\Skin.php file to be:

}

+ wfRunHooks('SkinBuildSidebar', array($this, &$bar));

if ( $wgEnableSidebarCache ) $parserMemc->set( $key, $bar, $wgSidebarCacheExpiry );

wfProfileOut( __METHOD__ );

return $bar;

}

}

awesome this makes it work!


Thanks a lot guys I was looking all day for this extension. I'm glad you guys were able to make a fix for older versions

~Maz

Not working with version 1.13.3, how to configure ?

I have uploaded following files in 'extensions/GoogleAdSense'

    • GoogleAdSense.class.php
    • GoogleAdSense.css
    • GoogleAdSense.i18n.php
    • GoogleAdSense.php

Then have inserted following text in localsettings.php(my wiki is in 'w' surdirectory'

require_once("extensions/GoogleAdSense/GoogleAdSense.php");
$wgGoogleAdSenseclient = 'pub-3670847027843858';
$wgGoogleAdSenseSlot = '4188378263';
$wgGoogleAdSenseID = '#4188378263';

Contents of MediaWiki:Common.css are:

/* Pad Google AdSense box in portlet in sidebar */
#p-googleadsense .pBody {
    padding-top: 5px;
    text-align:  center;
}

Skin.php has also been edited as mentioned above.

Still it is not working. please help to this newcomer--Maheshkumaryadav 07:09, 23 March 2009 (UTC)Reply

This extension works on version 1.13.1 with the above modification. Thanks!


Any way to get it working with 1.12 ? (Debian Lenny package)

Any way to get it working with 1.12 ? (mediawiki version in Debian Lenny is 1.12 ...)

This extension uses hooks that were not available in that version. You will not get it to work without changing the extension code (or manually backporting the feature(s) is use(s) that is/are not in 1.12. 1.12 is *ancient* and unsupported. Please upgrade! siebrand 09:40, 4 November 2009 (UTC)Reply

ad in wikipedia

is it possible to add this in wikipedia? --anon

Wikipedia will remain advertisement free. siebrand 09:38, 4 November 2009 (UTC)Reply

Nice Extension

Hi: I just installed this extension and it was really easy. However (always a however), and not to complain because it really is an useful extension, I'm having the following the problems:

  1. The ads are showing up ABOVE the search box. I don't mind being over the tool box, but the search kind of gets lost down there.
  2. They don't show up on all pages. The ads show up in articles, but not all of them Here's an article where it doesn't show up NO SHOWUP and here's one where it does SHOWUP. They are just articles with the same stuff inside, so I'm not really sure about what's going on.
  3. Ads don't show up on the frontpage. http://venciclopedia.com/

Any idea on these problems? Thanks in advance for your help.--Mark 16:49, 9 November 2009 (UTC)

All right, it's official, I'm a moron...CACHE! I was getting some nasty error messages that went away when I turn the extension off. I was caching the sidebar and using MEMCACHE even when I don't have memcache, etc. I would let you knwo if I learn anything else. I turned off sidebar caching and cleared my cache. I'm ready, I think, for google ads, even though I have another question, how can we forbid the extension to show up on certain namespaces or pages, like in Especial System Messages? --Mark 03:43, 21 November 2009 (UTC)

Other placement for ads

Hi! I´m trying to add more adds in other placementes like THIS PAGE. There is a top ad, with the "show only to anon users only" function enables. As and I can see in the source code, uses the same code as your extension... Any clue? Thanks! --Tango granada 02:48, 31 March 2010 (UTC)Reply

Sidebar position

Nice extension. Works fine in 1.15.1 and 15.1.2. Just one thing I'd like to change. How to set it under the search box? Currently is above the searchbox, which usually moves below the visible area of some monitors. Thanks in advance --Mark 13:21, 1 April 2010 (UTC)

Well, on my page, it appears UNDER the searchbox. www.airsoftpedia.es --Tango granada 21:15, 1 April 2010 (UTC)Reply
LOL. OK. I meant under the searchbox but above all the other menus.--Mark 06:24, 7 May 2010 (UTC)

Context sensitive?

Will the ads be related to context? E.g., if you are viewing a wiki page about Microsoft, might you get an ad for the latest version of Windows? Tisane 05:01, 8 April 2010 (UTC)Reply

Google AdSense 3?

Is there a major difference between this extension and the one at http://paulgu.com/wiki/Google_AdSense ? I notice both have the same author. Tisane 05:02, 17 April 2010 (UTC)Reply

Does it work with MW 1.16?

It's not working for me, but maybe something's not set up right. Tisane 20:12, 26 April 2010 (UTC)Reply

It's Not working with 1.65 either. 68.40.176.246 18:28, 1 June 2011 (UTC)Reply

Not working on MediaWiki 1.17

The title in the toolbar is showing, but the ad itself isn't appearing. Any suggestions? --Joejoebob 22:55, 2 September 2011 (UTC)Reply

Fixed my problem, there was an outstanding issue with my AdSense account. --Joejoebob 11:27, 27 September 2011 (UTC)Reply

AdSense 2 and Vector Skin

Hi!
is there a possibility that the drop down Menu is shown, when a new user gets on my website? At the Moment when you get on my site you have to click on GoogleAdsense Vector dropdown menu item to the the adsense content. You can see what I mean under http://wiki.laub-home.de there the "click to support me" Button.
Thanks for your help!

---> I found a solution: http://wiki.laub-home.de/index.php/Mediawiki_Extensions_Einbinden#Google_Adsense_Plugin

best way to include adsense in mediawiki

see the example in sitenotice in this site http://ponkavanam.com/islam/index.php?title=special:random add adsense in mediawiki without add extention. just add google gadget through media wiki widget.


{{#widget:Google Gadget
|url=http://www.worm.sh/custom_adsense.xml&amp;up_g_client=pub-4963274784930468&amp;up_g_slot=&amp;up_g_format=728x90&amp;synd=open&amp;w=800&amp;h=120&amp;title=%E0%B4%88+%E0%B4%B8%E0%B5%88%E0%B4%B1%E0%B5%8D%E0%B4%B1%E0%B4%BF%E0%B4%A8%E0%B5%86+%E0%B4%B8%E0%B4%AA%E0%B5%8D%E0%B4%AA%E0%B5%8B%E0%B5%BC%E0%B4%9F%E0%B5%8D%E0%B4%9F%E0%B5%8D+%E0%B4%9A%E0%B5%86%E0%B4%AF%E0%B5%8D%E0%B4%AF%E0%B5%81%E0%B4%95&amp;border=%23ffffff%7C0px%2C1px+solid+%2399BB66%7C0px%2C2px+solid+%23AACC66%7C0px%2C2px+solid+%23BBDD66&amp;output=js
|title=ഈ സൈറ്റിനെ സപ്പോർട്ട് ചെയ്യുക
|width=800
|height=120
}}

not working for MW1.19

I've just upgraded my site and I can't get google adsense to work for 1.19. Has anyone had any success here? Is the code in an iframe? Does it need to be tweaked? Thanks so much I'm really stuck.

Return to "Google AdSense/Archive" page.