(Special rate for the Six Figure Blogging course until Dec 2nd.)

« How I learned typing … | Home |   » Help needed: How to g…

How to only show ads after X days

03.07.05 | filed in Adsense, e, Tools

Most bloggers only have one layout and everybody is served the same, whether it is our daily readers or search engine traffic. But why? This article shows an example on how to differentiate those visitors based on the age of the post.

I just finished an article over at Darren's blog called "Ads: You can show them later!" which main suggestion is: Show ads only on blog posts older than some days.

I've compared the earnings of some of my blogs based on the amount of days passed, and found that I only get some cents from daily visitors. So why annoy them with advertisement when they won't click anyway? If you are wondering - I have not done the implementation on all blogs as you can see here. ;)

It will depend on your blogging software to develop the mechanism, but usually you do have a way to get to the date of the blog post. Of course, you should start slow and at first gather information whether or not you earn money on those days - it would be stupid to give that away.

How can we do that?
I use Adsense ads as example but of course this can be used by any kind of advertisement.

You can calculate how many days have passed since then and depending on the amount of days passed, you display different channel information. The following is a snippet written in PHP and the used blog software is Pivot but you should be able to adapt this.

function snippet_gad() {
 $datepost=format_date($db->entry["date"], "%year%-%month%-%day%" );

 $dayspassed = (round((strtotime("now") - strtotime($datepost))/(60*60*24)-1));
 if ($dayspassed>=3){

       $output .="google_ad_channel =\"channel1\";\n";

   if ($dayspassed>=7){
         $output .="google_ad_channel =\"channel2\";\n";
   }

   [output other google information including the java script link ]
 }

return $output;
 }
So if less then two days have passed, nothing is shown. If more than two days have passed, channel1 is used, otherwise channel2. Please note that this is a very simple implementation and I should just make that more than 4 days. :)

But you get the idea. With this kind of separation, you could also use it to display a different type of ads if somebody comes through Google to your site than from another referrer.

To spin this even further: You could also make a distinction between the accepted language from the browser: If it is German, display a German Amazon ID, if it is English, use the US store id.

trackback (0):

Trackback Link:
http://blogpraxis.de/pivot/tb.php?tb_id=27

comments (2):

Shai Coggins 04.07.05
If I were any better at PHP, I’d like to check how this works. Unfortunately, I’m not. :-( But, it’s a great idea that I’d like to keep in mind. Thanks!
Nicole Simon 04.07.05
it is not really that complicated to do it in php

$datepost=format_date($db->entry[“date”], “year-month-day” );

$db->entry[“date”] is the way to receive the date of the actual post
from pivot – you just need to figure out how to use the date in your
blogsoftwares :)

The rest is the same in all cases, because once you get the date,
it is transformed in this line (should be) into the format needed
and the rest stays the same. Maybe we should collect
a list of “how to get the date in software X” ;)


  

Please insert the result as normal figure.
Result of 5+8?

Name:  
Email:
URL:
Remember me

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.

Logo - Business blogs, Adsense und mehr
Blog tools, tips and tricks around professional and business blogging by Nicole Simon from Lübeck, Germany.

more / contact
 


English entries only:
Home
Feed (en)


English + German entries:

Startseite

Feed (de+en)


Last Comments
Nicole Simon
steven streight a…


Archives
July 2005
June 2005
May 2005
April 2005


My other pages
biz: Cruel to be kind
Useful Sounds
beissholz.de


Made with Pivot