Forcing only 1 Ad to show?

Discussion in 'AdSense' started by mark_s, Feb 24, 2006.

  1. #1
    I have a news website where under each news story there is a Google Ad. I only want there to be one below the first article to improve targeting but the way it is coded means it gets repeated for the rest of the articles in the page.

    Is it possible to force Adsense to only show the ad once?
     
    mark_s, Feb 24, 2006 IP
  2. equinoxprime

    equinoxprime Peon

    Messages:
    144
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You will have to take care of that in your publishing platform. Is it a wordpress blog? I can tell you how to do it...
     
    equinoxprime, Feb 24, 2006 IP
  3. mark_s

    mark_s Peon

    Messages:
    497
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It's just a phpBB mod to fetch threads from a particular section and treat it as news on the frontpage. Is there any code you can think of that I could add around the banner to make it only show once (without breaking TOS)?

    I here the more ads shown decreases your pay-per-click or something along those lines, therefore it's quite important to me.
     
    mark_s, Feb 24, 2006 IP
  4. mark_s

    mark_s Peon

    Messages:
    497
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #4
    *bump* please help! :(
     
    mark_s, Feb 25, 2006 IP
  5. huntz

    huntz Well-Known Member

    Messages:
    694
    Likes Received:
    109
    Best Answers:
    0
    Trophy Points:
    133
    #5
    huntz, Feb 25, 2006 IP
  6. mark_s

    mark_s Peon

    Messages:
    497
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Interesting mod but I don't think its what I'm looking for. I was hoping for some code to make it only show once for anything, not just phpBB. The way that mod works probably won't work with the news mod I'm using.

    Anyone some code I can put in to force it only to show once?
     
    mark_s, Feb 26, 2006 IP
  7. JL_99

    JL_99 Peon

    Messages:
    55
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7
    You basically need to use a while loop with a counter. if you are using blog software or a forum it would generally be in PHP or something like that.

    If you can provide a little bit more information about how your site is set up then I or somebody else here can probably help you out with the coding for that.
     
    JL_99, Feb 28, 2006 IP
  8. mark_s

    mark_s Peon

    Messages:
    497
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Sounds good although I was hoping some code would exist that would work in most situations. If customised code is needed I'll post at a later stage as I'm changing forum software from phpBB to SMF - so basically news will be then showed through the SSI feature.
     
    mark_s, Feb 28, 2006 IP
  9. JL_99

    JL_99 Peon

    Messages:
    55
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Sounds like you might as well wait a bit then. The idea behind the code will always be pretty much the same thing...but the syntax will of course vary depending one what language your site is coded in and what the general layout is. If you are running a standard phpBB forum then the code that is provided in the link a few posts ago should work great for you...but if you're running a blog or just a regular website then you need something else.
     
    JL_99, Mar 1, 2006 IP
  10. mark_s

    mark_s Peon

    Messages:
    497
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #10
    The banner shows under each news post which is displayed on the frontpage of my website using SMF's SSI features.

    I really want only 1 advert to show under the first newspost and for it not to be repeated all the down the page after everyone.

    The code:

    $return[count($return) - 1]['is_last'] = true;
    
    	if ($output_method != 'echo')
    		return $return;
    
    	foreach ($return as $news)
    	{
    		echo '
    			<div>
    				<a class="news_h1" href="', $news['href'], '">', ' <strong><h1>', $news['subject'], '</h1></strong></a>
    						<div class="date">Filed '.$news['time']. ' | ' . $news['link'],'</div>
    				<div class="news_body" >', $news['body'], '</div>
    			</div>';
    
    		if (!$news['is_last'])
    			echo '
    			<!-- Google Ads -->
    <div class="headline_advert">
    
    <script type="text/javascript"><!--
    google_ad_width = 468;
    google_ad_height = 60;
    google_ad_format = "468x60_as";
    google_ad_type = "text";
    google_color_border = "FFFFFF";
    google_color_bg = "F8F8F8";
    google_color_link = "666666";
    google_color_url = "666666";
    google_color_text = "666666";
    //--></script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    
    </div>
    <!-- End Google Ads -->';
    	}
    }
    Code (markup):
     
    mark_s, Apr 23, 2006 IP
  11. mark_s

    mark_s Peon

    Messages:
    497
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #11
    I found a way of doing it just using SSI features, I no longer need any help.
     
    mark_s, Apr 23, 2006 IP