Industry guru Dave Taylor offers free tech support on a wide variety of technical and business topics, including HTML, Apple iPhone, online advertising, Cascading Style Sheets, Web design, management, Unix, Linux, search engine optimization, online dating, Mac OS X, shell script programming and Microsoft Windows.

How can I have Google AdSense ads open in a new window?

Hi I need to know how to change the target of the Google AdSense ads via script. I changed the background by using: google_color_bg = "E5EBF2"; but now I need to change the target of the hyperlinks to open in a new window. can you please help.


Dave's Answer:

It's always a bit of a dilemma when I get this sort of question because I know that there are ways to tweak your AdSense block to change its behavior, including having the ads open in a new window, but I'm also very aware of the AdSense Terms of Service, which states:

"You agree to comply with the specifications provided by Google from time to time to enable proper delivery, display, tracking, and reporting of Ads, Links, Search Results, Referral Buttons, and Google Brand Features (as defined in Section 12 below) in connection with Your Site(s), including without limitation by not modifying the JavaScript or other programming provided to You by Google in any way, unless expressly authorized in writing by Google (including by electronic mail)."

The key phrase here is by not modifying the JavaScript or programming provided to You by Google.

Doesn't sound to me like it's okay for people to be hacking and tweaking their AdSense beyond the range of modifications to appearance that are expressly authorized by the company. On the one hand I know people who are frustrated by this limitation, but on the other hand, it's their ad network, so if you really don't like the terms and conditions, well, there are alternatives.

Still not entirely sure that I'm correct? Consider this Q&A from Google entitled Can I open the ads in a new window? in which it says quite explicitly:

"Keeping in mind the importance of the user experience, we generally have not allowed Google ads to open in a new window. However, in a few markets, including China, we've found that opening ads in a new window better aligns with expected internet behavior and provides a more consistent, intuitive user experience. After significant testing, we've enabled Google ads to open in new windows in locations where this is expected browsing behavior. This functionality is determined by the IP of the user, and is not an option you can select your AdSense account.

"We also ask that you don't modify the AdSense ad code or alter the result of clicking on an ad on your website, as such behavior violates our program policies."

That's a very polite way of saying no, and don't monkey with it, pal!

Having said all of that, it's also likely true that if you dig deep enough you can find some sort of tips from hackers about how to tweak the behavior of your AdSense block anyway. Just don't be surprised if you get a notice from Google one day that you've been kicked out of the program for violations of their terms and conditions.



Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Stumble Upon    

Subscribe!

Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.

Comments

http://www.dynamicdrive.com/dynamicindex8/newwindow2.htm

If you do exactly what is said there, your problems will be solved.

Posted by: Darren at April 17, 2008 9:38 AM

WARNING: While the link Darren provides might offer up the ability to have your AdSense ads open up in a new browser window, be aware that this is a VIOLATION OF THE TERMS OF SERVICE and once Google notices, you'll probably be kicked out of the system.

Visit that link, and any others that offer to tweak or modify the AdSense code, at your own risk.

Posted by: Dave Taylor at April 17, 2008 11:32 AM

I have this code in my oscommerce' html banner config in the admin area. Is this considered a violation in the Google's Terms & Condition?



Posted by: chrish at September 28, 2008 8:23 PM

Quote: "...in a few markets, including China, we've found that opening ads in a new window better aligns with expected internet behavior and provides a more consistent, intuitive user experience. After significant testing, we've enabled Google ads to open in new windows in locations where this is expected browsing behavior. This functionality is determined by the IP of the user, and is not an option you can select your AdSense account."

Does anybody know anything about these IP limitations? Are they country based? I've tried finding some sites about this topic, but can't seem to find anything. If you know, please hit me back on the 8 track. Thanks in advance for any help! :)

Alex @ Gone-surfing.com

Posted by: Gone Surfing at February 11, 2009 5:05 AM

I think now its possible if you use Google Ad Manager.

Check out http://www.codeitwell.com/how-to-open-adsense-in-new-window-safely.html

Posted by: Shabbir at May 17, 2009 9:24 PM

thanks alot for putting up the info, it helped me to clear few info about google ads for my games website.

Posted by: l3bl3b at August 6, 2009 7:43 AM

Note that if the user wants the ad to open in a new window or tab, the user can choose to click right on the link and then select the appropriate option. Google does not prevent that. So, if the use wants to keep your content open but also wishes to view the ad, the user has that option, even though the default click behavior is to take the user away from your content.

Posted by: Carl at August 24, 2009 1:55 AM

Modifying Google's Javascript to make ads open in a new window is a clear violation. However, what is not as clear is whether it is a violation to open a content-based page that *contains* Google ads in a new window, *from* a page that contains ads. For example, if you had links to help pages and wanted those pages to come up in a new window, and those help pages has Google ads on them, would creating links that automatically opened in a new window be a violation of the TOS? I don't think that it would violate the TOS, but the language on this page (https://www.google.com/adsense/support/bin/answer.py?answer=9737) is somewhat ambiguous: "Generally, it is our policy to not allow Google ads to open in a new window." I think they mean "open" as in "go to the advertiser's Web site," but they *could* mean "open" as in "display the ad itself." So, it would be helpful if you could disambiguate this here (even better if Google did that).

Posted by: Lou Thomas at December 1, 2009 1:53 AM

Lou, I asked my contact inside the Google AdSense team and here's what he sent back:

I don't have much more information than you've already provided. The AdSense Help Center provides the same information that you've given:

https://www.google.com/adsense/support/bin/answer.py?hl=en&answer=9737

Of particular note is the final line in the Help Center entry. As stated, altering "the result of clicking on an ad" is a violation of the AdSense program policies.

Posted by: Dave Taylor at December 2, 2009 11:55 AM

Dave,
We are configuring our account with Google Ad Manager and it allows us to put the code from all Ad networks with the option to open in a new window, this would not be editing the code at all but we wanted to know if this is within their terms of service. We want to abide by their terms so we need to make 100% sure before we proceed. I did email Google but no reply yet.

Posted by: Kris at January 12, 2010 2:58 PM

Funny how Gmail ads open in a new window, isn't it?

Posted by: Tomer at February 21, 2010 2:33 PM

I have something to say, now that you mention it, but ...
Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you for all your efforts on this Web site by buying you a cup of coffee!

I do have a comment, now that you mention it!











Remember personal info?


Please note that I will never send you any unsolicited email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.








Ask Dave Taylor: The iPhone App: Advertisement



Follow me on Twitter @DaveTaylor

Search
Find just the answers you seek from among our 2300+ free tech support articles by using our Lijit search engine.


Help!





Subscribe to
Ask Dave Taylor!

Add to Google Reader
Add to My Yahoo!
Subscribe in NewsGator Online

RDF   XML

Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.


Recent Entries
Book Links
© 2002 - 2010 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]
"Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.