Free Wordpress Help | How To Force Wordpress To Give You Relevant Adsense Ads

Ask me a question at the Wordpress Ninja Forum

 

How To Force Wordpress To Give You Relevant Adsense Ads

Posted on July 22, 2008
Filed Under Wordpress Solutions |

I struggled with this for some time, before working out that you can ‘force’ Wordpress to serve up relevant Google Adsense Ads from the get go, rather than wait several weeks for it to start serving relevant ads. By relevant i mean actually related to you site content, rather than some random unrelated garbage.

I tried everything including section targeting for the Google ads, where you tell the code where to include or exclude content for Google to use for it’s ad algorithms. No joy, it still wouldn’t serve up relevant ads. However, i should clarify this - all ads would show up relevant if i went directly to my homepage with the /index.php after it e.g. http://www.wordpressninja.com/index.php though it would be irrelevant if i just typed in http://www.wordpressninja.com to my browser.

This gave me a clue, seeing as it was related to the actual url being entered. That’s when i investigated the wp-config file and eventually worked this out.

Now i have read many posts from people around the web with the same issue but no real solution - some people said it would just fix itself after some time - maybe related to Google indexing it? But in my case it just would not serve relevant Google Adsense Ads even after 2 weeks.

Anyway, this fix worked for me, though i can’t guarantee it will work for you too as it may also depend on your hosting server’s config. In a nutshell you need to overide the home and siteurl DB settings. To do this, edit your wp-config.php file in the wordpress install root and add the following lines of code after the existing DEFINE statements at the top. This code example here is if you installed WP into a subdirectory:

define(’WP_SITEURL’, ‘http://www.sample.com/subdir’);
define(’WP_HOME’, ‘http://www.sample.com’);

Obviously you need to put your own site in there. If your WP install is not in a subdirectory then it should just be like this code example:

define(’WP_SITEURL’, ‘http://www.sample.com’);
define(’WP_HOME’, ‘http://www.sample.com’);

That’s it, after saving those changes the ads immediately become relevant for the home url http://www.xxxxxx.com, just like the /index.php url shows.

Let me know if it works for you or not.

Also, remember to back up your files and DB before doing any changes like this, just in case something breaks badly - yes, i’ve been there and it is not a nice place to be.

Comments

3 Responses to “How To Force Wordpress To Give You Relevant Adsense Ads”

  1. joelwyn on August 24th, 2008 11:16 am

    Hi, i follow your method but it doesn’t work, too bad.
    Thanks anyway

  2. WPNinja on August 26th, 2008 6:18 am

    hmmm…should work…you mean the adsense wasn’t relevant after doing that? Email me your site address and ill have a look…wpninja@wordpressninja.com

    cheers,

    Paul.

  3. Chandra on November 10th, 2008 8:05 pm

    Well written article.

Leave a Reply




 

Related Posts: