When a post is published on your blog, the first persons to read it are your loyal visitors : RSS subscribers, Twitter followers, people from social bookmarking sites… But after a week or so, 98 percent of people reading the post are comming to your blog from search engines. As it is a known fact that search engine people will be more likely to click on your ads, what about displaying more ads on old blog posts? Why old posts are so important On a quite new blog like this one, It is obvious that most of the traffic is comming from RSS subscibers, Twitter, and social bookmarking sites. But on the other hand, established blogs as such as Cats Who Code or WpRecipes receive a lot more traffic on “old” post, comming from search engines. The reason is quite simple : The more indexed posts in search engines you have, the more chance you have that people will visit your blog after typing a request on Google. This is why some blogs are updated only once or twice a month and still receive lots of visitors.  Good example : 4 of the 5 most viewed pages of my blog Cats Who Code are older than 3 months. Search engines visitors and advertising It is a quite known fact that people comming from search engines results pages are more likely to click on advertisments than your regular visitors. The reason is that search engines visitors are looking for something in particular and if your blog post didn’t brought them an answer (or that they want more info) they will probably click on an ad if relevant to their needs. On the other hand, regular visitors are used to your blog and read it often because they like it. They aren’t looking for something particular, they read each of your post like people reads the newspaper every morning. WordPress hack to display ads on old posts only As I know that most of you are using a WordPress blog, I though I could share this very usefull WordPress hack with you. Its purpose is pretty simple: It get the post date and compare it with today’s date. If post date is X days older than today, the code will display ads. Otherwise, nothing will happens. The following function have to be pasted in your functions.php. If you are using the Thesis theme this file is named custom_functions.php. function is_old_post($post_id=null){ $days = 15; global $wp_query; if(is_single() || is_page()) { if(!$post_id) { $post_id = $wp_query->post->ID; } $current_date = time(); $offset = $days *60*60*24; $post_id = get_post($post_id); $post_date = mysql2date('U',$post_id->post_date); $cunning_math = $post_date + $offset; $test = $current_date - $cunning_math; if($test > 0){ $return = true; }else{ $return = false; } }else{ $return = false; } return $return; } Once you successfully inserted the code in your function.php file, you are now ready to call the functions in your single.php template as shown below: <?php if(is_old_post()){ ?> INSERT AD CODE HERE <?php } ?> That’s all. This code have been found on the very good French blog Monetiweb, so credits goes to them! Displaying ads only to search engine visitors If you’re looking to target search engine visitors only, another option is to detect the referrer (ie. the last page the visitor was on before going to your blog) and show him ads if he comes from a search engine. The following WordPress hack will do that job perfectly. To apply it on your blog, insert the code below in your theme functions.php file. Note that the $SE array is where you specify search engines. You can easily ad new search engines by adding new elements to the array. function scratch99_fromasearchengine(){ $ref = $_SERVER['HTTP_REFERER']; $SE = array('/search?', 'images.google.', 'web.info.com', 'search.', 'del.icio.us/search', 'soso.com', '/search/', '.yahoo.'); foreach ($SE as $source) { if (strpos($ref,$source)!==false) return true; } return false; } Once done, open the file where you want to display the ads and paste the following code : if (function_exists('scratch99_fromasearchengine')) { if (scratch99_fromasearchengine()) { INSERT YOUR CODE HERE } } Save the file, and you’re done. Thanks to Stephen Cronin for the hack! If you’re blogging using WordPress, don’t forget to check out my WordPress hacks to make more money online list if you haven’t read it yet.  |
No comments:
Post a Comment