View Single Post
  #23 (permalink)  
Old 03-18-2007, 11:11 PM
Critter183 Critter183 is offline
Pligg Donor
 
Join Date: Mar 2007
Posts: 34
Thanks: 8
Thanked 3 Times in 3 Posts
I did a little tinkering today. I enabled adsense revshare and I wanted that to work in conjunction with my adsense ads in my header.tpl.

The following code displays my site logo on the left and uses my AdSense ID on all pages except the story page of any of my users who have plugged in their own ID, where we will split the ad exposure at the default 50/50 for now:

PHP Code:
Line 36:</div>
<!-- 
My mods begin here -->

<
p>&nbsp;</p>
<
table border="0" cellpadding="4" width="100%"><tr>
<
td align="center" valign="top">
<
img src="http://www.mydomain.com/templates/yget/images/logo.jpg" alt="My Logo" />
</
td>
<
td align="center" valign="top">
{if 
$pagename eq 'index' || $pagename eq 'search' || $pagename eq 'upcoming'}
<
script type="text/javascript"><!--
google_ad_client "pub-xxxxxxxxxxxxxxxx";
google_ad_width 728;
google_ad_height 90;
google_ad_format "728x90_as";
google_ad_type "text";
google_ad_channel "xxxxxxxxx";
google_color_border "ffffff";
google_color_bg "ffffff";
google_color_link "E1771E";
google_color_text "000000";
google_color_url "940F04";
//--></script>
<script type="text/javascript"
  
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
{elseif $pagename eq 'story'}
{adsense assign=users_adsense}
{if $users_adsense}
    <script type="text/javascript"><!--
        google_ad_client = "{$google_adsense_id}";
        google_alternate_ad_url = "";
        google_ad_width = 728;
        google_ad_height = 90;
        google_ad_format = "728x90_as";
        google_ad_type = "text";
        google_ad_channel ="{$google_adsense_channel}";
        google_color_border = "ffffff";
        google_color_bg = "ffffff";
        google_color_link = "E1771E";
        google_color_text = "000000";
        google_color_url = "940F04";
        //-->
    </script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    {else}
    <script type="text/javascript"><!--
google_ad_client = "pub-xxxxxxxxxxxxxxxx";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text";
google_ad_channel = "xxxxxxxxx";
google_color_border = "ffffff";
google_color_bg = "ffffff";
google_color_link = "E1771E";
google_color_text = "000000";
google_color_url = "940F04";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
{/if}
{/if}
</td></tr></table>
<p>&nbsp;</p>

<!-- My mods end here -->

<div id="cab"> 
The mods begin after line 36 in header.tpl of the yget template. Replace "pub-xxxxxxxxxxxxxxxxx" in two instances in this mod with your google adsense ID.

Replace the "xxxxxxxx" in two instances of "google_ad_channel ="xxxxxxxxx";" with your ad channel ID or remove the x's and leave empty if you don't use channels. I set up a few channels at google adsense so I can see if clicks are coming from my ads on story pages or on published or upcoming pages.

Do not edit "google_ad_client = "{$google_adsense_id}";" or "google_ad_channel ="{$google_adsense_channel}";" as those are related to your users' adsense ID and channel.

I tested it pretty thorougly tonight and it works just dandy. :)

Last edited by Critter183; 03-18-2007 at 11:15 PM..
Reply With Quote