Google Adsense extension
Google Adsense extension
I am using your Google Adsense extension on my wiki. For the adsense content (<google>WIKI</google>)I would like to change the color of links in the Google Ads. I can't find the setting in GoogleAdsense.php. Could you tell me how I can change the html color for links in the google ads?
Re: Google Adsense extension
Open file GoogleAdSense.php, you can see many color code such as #008000, #336699, FFFFFF etc. Try to change those and see what you can get.
Re: Google Adsense extension
This is Version 1.7 and the contents of my GoogleAdSEnse.php ... I do not see any html color codes... can you tell me where to find it?
$wgExtensionCredits['other'][] = array
(
'name' => "GoogleAdSense",
'version' => "1.7, May 18, 2007",
'author' => 'Paul Gu',
'url' => 'http://paulgu.com',
'description' => 'Google Adsense extension'
);
$wgExtensionFunctions[] = "wgasExtension";
function wgasExtension() {
global $wgParser;
$wgParser->setHook( "google", "populategoogle" );
}
# The callback function for HTML output
function populategoogle( $input, $argv, &$parser ) {
include("Settings.php"); // get client information
# Google search only
$outputSearch =
"<div id=\"googleSearchWrapper\">\n" .
"<div class=\"googleSearch\">\n" .
"<form method=\"get\" action=\"http://www.google.com/custom\" target=\"_blank\">\n" .
"<table border=\"0\" bgcolor=\"#ffffff\">\n" .
"<tr><td nowrap=\"nowrap\" valign=\"top\" align=\"left\" height=\"32\">\n" .
"<a href=\"http://www.google.com/\">\n" .
"<img src=\"http://www.google.com/logos/Logo_25wht.gif\" border=\"0\" alt=\"Google\" align=\"middle\"></img></a>\n" .
"<input type=\"text\" name=\"q\" size=\"31\" maxlength=\"255\" value=\"$input\"></input>\n" .
"<input type=\"submit\" name=\"sa\" value=\"Search\"></input>\n" .
"<input type=\"hidden\" name=\"client\" value=\"$clientID\"></input>\n" .
"<input type=\"hidden\" name=\"forid\" value=\"1\"></input>\n" .
"<input type=\"hidden\" name=\"ie\" value=\"ISO-8859-1\"></input>\n" .
"<input type=\"hidden\" name=\"oe\" value=\"ISO-8859-1\"></input>\n" .
"<input type=\"hidden\" name=\"cof\"\n" . "value=\"GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1\"></input>\n" .
"<input type=\"hidden\" name=\"hl\" value=\"en\"></input>\n" .
"</td></tr></table>\n" .
"</form></div></div>";
# Google search and my domain search
$outputSearch2 =
"<div id=\"googleSearchWrapper\">\n" .
"<div class=\"googleSearch\">\n" .
"<form method=\"get\" action=\"http://www.google.com/custom\" target=\"_blank\">" .
"<table border=\"0\" bgcolor=\"#ffffff\">" .
"<tr><td nowrap=\"nowrap\" valign=\"top\" align=\"left\" height=\"32\">" .
"<a href=\"http://www.google.com/\">" .
"<img src=\"http://www.google.com/logos/Logo_25wht.gif\" border=\"0\" alt=\"Google\" align=\"middle\"></img></a>" .
"</td>" .
"<td nowrap=\"nowrap\">" .
"<input type=\"hidden\" name=\"domains\" value=\"www.paugu.com\"></input>" .
"<input type=\"text\" name=\"q\" size=\"31\" maxlength=\"255\" value=\"$input\"></input>" .
"<input type=\"submit\" name=\"sa\" value=\"Search\"></input>" .
"</td></tr>" .
"<tr>" .
"<td> </td>" .
"<td nowrap=\"nowrap\">" .
"<table>" .
"<tr>" .
"<td>" .
"<input type=\"radio\" name=\"sitesearch\" value=\"\"></input>" .
"<font size=\"-1\" color=\"#000000\">Web</font>" .
"</td>" .
"<td>" .
"<input type=\"radio\" name=\"sitesearch\" value=\"www.paugu.com\" checked=\"checked\"></input>" .
"<font size=\"-1\" color=\"#000000\">www.paugu.com</font>" .
"</td>" .
"</tr>" .
"</table>" .
"<input type=\"hidden\" name=\"client\" value=\"$clientID\"></input>" .
"<input type=\"hidden\" name=\"forid\" value=\"1\"></input>" .
"<input type=\"hidden\" name=\"ie\" value=\"ISO-8859-1\"></input>" .
"<input type=\"hidden\" name=\"oe\" value=\"ISO-8859-1\"></input>" .
"<input type=\"hidden\" name=\"cof\"" . "value=\"GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1\"></input>" .
"<input type=\"hidden\" name=\"hl\" value=\"en\"></input>" .
"</td></tr></table>" .
"</form></div></div>";
$output = $outputSearch; // default is Google search
foreach($channels as $channelName => $channelID) {
if($input == $channelName) {
if ($channelName == "REF") {
$output = gAdSenseforReferrals($clientID, $channelID );
} else {
$output = gAdSenseforContent468($clientID, $channelID );
}
}
}
return $output;
}
# The function for Google Channel
function gAdSenseforContent468($clientID, $channel ) {
$rc =
"<div id=\"googleContentWrapper\">\n" .
"<p class=\"googleContent\"><script type=\"text/javascript\">\n" .
"google_ad_client = \"$clientID\";\n" .
"google_ad_width = 468;\n" .
"google_ad_height = 60;\n" .
"google_ad_format = \"468x60_as\";\n" .
"google_ad_type = \"text\";\n" .
"google_ad_channel = \"" . $channel . "\";\n" .
"</script>\n" .
"<script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pa ... ds.js\">\n" .
"</script></p></div>";
return $rc;
}
# The function for Google Channel
function gAdSenseforContent728($clientID, $channel ) {
$rc =
"<div id=\"googleContentWrapper\">\n" .
"<p class=\"googleContent\"><script type=\"text/javascript\">\n" .
"google_ad_client = \"$clientID\";\n" .
"google_ad_width = 728;\n" .
"google_ad_height = 90;\n" .
"google_ad_format = \"728x90_as\";\n" .
"google_ad_type = \"text\";\n" .
"google_ad_channel = \"$channel\";\n" .
"</script>\n" .
"<script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pa ... ds.js\">\n" .
"</script></p></div>";
return $rc;
}
# The function for Google Referrals
function gAdSenseforReferrals($clientID, $channel ) {
$rc =
"<div id=\"googleReferralWrapper\">\n" .
"<p class=\"googleReferral\"><script type=\"text/javascript\">\n" .
"google_ad_client = \"$clientID\";\n" .
"google_ad_width = 468;\n" .
"google_ad_height = 60;\n" .
"google_ad_format = \"468x60_as_rimg\";\n" .
"google_cpa_choice = \"CAAQlfaWhAIaCDgcetl7W8a7KNvD93M\";\n" .
"google_ad_channel = \"\";\n" .
"</script>\n" .
"<script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pa ... ds.js\">\n" .
"</script></p></div>";
return $rc;
}
?>
$wgExtensionCredits['other'][] = array
(
'name' => "GoogleAdSense",
'version' => "1.7, May 18, 2007",
'author' => 'Paul Gu',
'url' => 'http://paulgu.com',
'description' => 'Google Adsense extension'
);
$wgExtensionFunctions[] = "wgasExtension";
function wgasExtension() {
global $wgParser;
$wgParser->setHook( "google", "populategoogle" );
}
# The callback function for HTML output
function populategoogle( $input, $argv, &$parser ) {
include("Settings.php"); // get client information
# Google search only
$outputSearch =
"<div id=\"googleSearchWrapper\">\n" .
"<div class=\"googleSearch\">\n" .
"<form method=\"get\" action=\"http://www.google.com/custom\" target=\"_blank\">\n" .
"<table border=\"0\" bgcolor=\"#ffffff\">\n" .
"<tr><td nowrap=\"nowrap\" valign=\"top\" align=\"left\" height=\"32\">\n" .
"<a href=\"http://www.google.com/\">\n" .
"<img src=\"http://www.google.com/logos/Logo_25wht.gif\" border=\"0\" alt=\"Google\" align=\"middle\"></img></a>\n" .
"<input type=\"text\" name=\"q\" size=\"31\" maxlength=\"255\" value=\"$input\"></input>\n" .
"<input type=\"submit\" name=\"sa\" value=\"Search\"></input>\n" .
"<input type=\"hidden\" name=\"client\" value=\"$clientID\"></input>\n" .
"<input type=\"hidden\" name=\"forid\" value=\"1\"></input>\n" .
"<input type=\"hidden\" name=\"ie\" value=\"ISO-8859-1\"></input>\n" .
"<input type=\"hidden\" name=\"oe\" value=\"ISO-8859-1\"></input>\n" .
"<input type=\"hidden\" name=\"cof\"\n" . "value=\"GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1\"></input>\n" .
"<input type=\"hidden\" name=\"hl\" value=\"en\"></input>\n" .
"</td></tr></table>\n" .
"</form></div></div>";
# Google search and my domain search
$outputSearch2 =
"<div id=\"googleSearchWrapper\">\n" .
"<div class=\"googleSearch\">\n" .
"<form method=\"get\" action=\"http://www.google.com/custom\" target=\"_blank\">" .
"<table border=\"0\" bgcolor=\"#ffffff\">" .
"<tr><td nowrap=\"nowrap\" valign=\"top\" align=\"left\" height=\"32\">" .
"<a href=\"http://www.google.com/\">" .
"<img src=\"http://www.google.com/logos/Logo_25wht.gif\" border=\"0\" alt=\"Google\" align=\"middle\"></img></a>" .
"</td>" .
"<td nowrap=\"nowrap\">" .
"<input type=\"hidden\" name=\"domains\" value=\"www.paugu.com\"></input>" .
"<input type=\"text\" name=\"q\" size=\"31\" maxlength=\"255\" value=\"$input\"></input>" .
"<input type=\"submit\" name=\"sa\" value=\"Search\"></input>" .
"</td></tr>" .
"<tr>" .
"<td> </td>" .
"<td nowrap=\"nowrap\">" .
"<table>" .
"<tr>" .
"<td>" .
"<input type=\"radio\" name=\"sitesearch\" value=\"\"></input>" .
"<font size=\"-1\" color=\"#000000\">Web</font>" .
"</td>" .
"<td>" .
"<input type=\"radio\" name=\"sitesearch\" value=\"www.paugu.com\" checked=\"checked\"></input>" .
"<font size=\"-1\" color=\"#000000\">www.paugu.com</font>" .
"</td>" .
"</tr>" .
"</table>" .
"<input type=\"hidden\" name=\"client\" value=\"$clientID\"></input>" .
"<input type=\"hidden\" name=\"forid\" value=\"1\"></input>" .
"<input type=\"hidden\" name=\"ie\" value=\"ISO-8859-1\"></input>" .
"<input type=\"hidden\" name=\"oe\" value=\"ISO-8859-1\"></input>" .
"<input type=\"hidden\" name=\"cof\"" . "value=\"GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1\"></input>" .
"<input type=\"hidden\" name=\"hl\" value=\"en\"></input>" .
"</td></tr></table>" .
"</form></div></div>";
$output = $outputSearch; // default is Google search
foreach($channels as $channelName => $channelID) {
if($input == $channelName) {
if ($channelName == "REF") {
$output = gAdSenseforReferrals($clientID, $channelID );
} else {
$output = gAdSenseforContent468($clientID, $channelID );
}
}
}
return $output;
}
# The function for Google Channel
function gAdSenseforContent468($clientID, $channel ) {
$rc =
"<div id=\"googleContentWrapper\">\n" .
"<p class=\"googleContent\"><script type=\"text/javascript\">\n" .
"google_ad_client = \"$clientID\";\n" .
"google_ad_width = 468;\n" .
"google_ad_height = 60;\n" .
"google_ad_format = \"468x60_as\";\n" .
"google_ad_type = \"text\";\n" .
"google_ad_channel = \"" . $channel . "\";\n" .
"</script>\n" .
"<script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pa ... ds.js\">\n" .
"</script></p></div>";
return $rc;
}
# The function for Google Channel
function gAdSenseforContent728($clientID, $channel ) {
$rc =
"<div id=\"googleContentWrapper\">\n" .
"<p class=\"googleContent\"><script type=\"text/javascript\">\n" .
"google_ad_client = \"$clientID\";\n" .
"google_ad_width = 728;\n" .
"google_ad_height = 90;\n" .
"google_ad_format = \"728x90_as\";\n" .
"google_ad_type = \"text\";\n" .
"google_ad_channel = \"$channel\";\n" .
"</script>\n" .
"<script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pa ... ds.js\">\n" .
"</script></p></div>";
return $rc;
}
# The function for Google Referrals
function gAdSenseforReferrals($clientID, $channel ) {
$rc =
"<div id=\"googleReferralWrapper\">\n" .
"<p class=\"googleReferral\"><script type=\"text/javascript\">\n" .
"google_ad_client = \"$clientID\";\n" .
"google_ad_width = 468;\n" .
"google_ad_height = 60;\n" .
"google_ad_format = \"468x60_as_rimg\";\n" .
"google_cpa_choice = \"CAAQlfaWhAIaCDgcetl7W8a7KNvD93M\";\n" .
"google_ad_channel = \"\";\n" .
"</script>\n" .
"<script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pa ... ds.js\">\n" .
"</script></p></div>";
return $rc;
}
?>
Re: Google Adsense extension
I saw there are many color code there!
Code: Select all
"<input type=\"hidden\" name=\"cof\"" . "value=\"GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1\"></input>"
Re: Google Adsense extension
Those hex numbers are for Google search right? I am asking about the text link context ads - which looks like its under the Google channel section on your GoogleAdsense.php file. For that section there doesnt seem to be any color codes. I tried to change the numbers you pointed out but that did not have any effect on the text ads.
Re: Google Adsense extension
You can try create a customized ads in Google to see if you could change that.
or you can try this:
The "T:000000;" stands for text color.
or you can try this:
Code: Select all
"value=\"GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1\"></input>"
Re: Google Adsense extension
How do I use this extension and choose between different ad "slots" I have set up in adSense? For instance, I have a medium size banner, and a larger banner and I'd like to use them in different situations (I'd also like to use the color schemes I have set up in adsense). In the code given by google to put directly into html there is a line:
google_ad_slot = "0717425499";
right around:
google_ad_slot = "0717425499";
google_ad_width = 468;
google_ad_height = 60;
which tells google which "style" ad to send to the page. Is this possible with your extension? Also, how do I switch or select between the two banner widths already programmed into the googleadsense.php (I see code for a 468 pixel wide banner and a 728 pixel wide banner, so far only the 468px wide banner has been showing up for me).
Thanks in advance.
google_ad_slot = "0717425499";
right around:
google_ad_slot = "0717425499";
google_ad_width = 468;
google_ad_height = 60;
which tells google which "style" ad to send to the page. Is this possible with your extension? Also, how do I switch or select between the two banner widths already programmed into the googleadsense.php (I see code for a 468 pixel wide banner and a 728 pixel wide banner, so far only the 468px wide banner has been showing up for me).
Thanks in advance.
Re: Google Adsense extension
This could be done by modifying the php file, you need to add all ads scripts in the php file, then use if statement to determine which one you want to display.
Just follow the logic I had in my ads extension.
Just follow the logic I had in my ads extension.
- classbrain
- Rank 0
- Posts: 3
- Joined: April 9th, 2008, 4:10 am
Re: Google Adsense extension- colors
You are both going at it backwards. Choose your color palettes in Google Adsense. You can define custom palettes, and channels and then choose them mix and match style. Simply define a Channel ID for each color paletted ad you want to use, and copy the code number that identifies your ad (see Manage Ads in Google) into the array location. Presto.. everything is managed in Google, and thanks to the ad manager they recently installed, you can make a change to your saved ad in Google Adsense, and it will change it on your site.