masthead image

Technology Blog

Adsense Ads In Other Countries

Wednesday March 11 2009, 02:32 PM

A question was posed on Digital Point Forums today on how to determine what kind of ad will show up in Adsense if you were visiting from another country. After pondering this for a bit, I tried to come up with an answer. Here's the spelunking I did to arrive at an answer.

So lets say you have a website in Spain with pages marked up in XHTML and in the Spanish language. You want to know what your Google ads will look like if a United States visitor went to your website.

One thing that came to my mind is that to support different languages, all Google has to do is detect the xml:lang and lang attributes in the html tags. But after trying to markup a simple XHTML document doing this and putting in an Adsense ad, it didn't work.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">

So I then thought about other language attributes and came up with the Content-Type meta tag and set the charset to various types. That didn't work either.

  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

Then I thought about the language setting in the browser and switched it to es for Spanish. That didn't work either. I then tried to add the google_language = es variable to the adsense code to see if that would work. Nope, didn't work.

<script type="text/javascript"><!--
google_ad_client = "pub-8234723979439773";
/* 336x280, created 2/15/09 */
google_ad_slot = "0845260023";
google_ad_width = 336;
google_ad_height = 280;
google_language = "es";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

I finally came to the conclusion that Google is extremely smart about things and uses the IP address of the visitor to determine the country to render the ad. This seems wrong to me because they should be using the language that the document was created in.

Stumped, I went off grumbling wanting to know more. Then I got lucky and found out that there is an Adsense Preview Tool available that allows you to choose the country. Simply right click on the page and up comes a window where you choose the Google preview tool and set the geolocation.

So if you are interested in knowing what Google ads will show up on a particular website page, you can download and use the Google Preview Tool to determine this.