Welcome to WebmasterWorld Guest from 54.160.254.203

Forum Moderators: incrediBILL & martinibuster

Message Too Old, No Replies

Embedding Adsense Code with jQuery

Does it violate Adsense Program Policy?

     
7:50 am on Jul 7, 2012 (gmt 0)

Junior Member

10+ Year Member

joined:July 2, 2003
posts: 112
votes: 0


I want to know if it is against the Adsense Program Policies to embed Adsense code using jQuery?

I want to append adsense code on my page dynamically after the first paragraph of content which can be done easily with jQuery.

Not too sure if it violates Adsense Program Policy?
8:03 am on July 7, 2012 (gmt 0)

Preferred Member

10+ Year Member

joined:Dec 12, 2004
posts:608
votes: 1


Against the policy, and appending Adsense code wouldn't work.
8:17 am on July 7, 2012 (gmt 0)

Administrator from US 

WebmasterWorld Administrator incredibill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 25, 2005
posts:14624
votes: 88


Against the policy, and appending Adsense code wouldn't work.


How does embedding dynamically vs. static embedding violate the policy?

It shouldn't be a problem that I'm aware of but it probably bears re-reading the policies to make sure, but as long as you aren't altering the code or doing anything forbidden like pop-ups, floating ads, etc. it should be fine.

I dynamically embed AdSense but I do it server side, not in Javascript, but which method is used shouldn't really matter IMO.

The only way to really be sure is to ask an AdSense rep.
4:22 am on July 8, 2012 (gmt 0)

Preferred Member

10+ Year Member

joined:Dec 12, 2004
posts:608
votes: 1


jQuery is client-side. Appending the code itself won't even work. You can append an iframe that has the adsense code, but using iframe is against policy. Also you can switch to the DFP async code and call 'gpt.js' after appending the ad code, but as always best thing to do is to contact Adsense first..
4:58 am on July 8, 2012 (gmt 0)

Administrator from US 

WebmasterWorld Administrator incredibill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 25, 2005
posts:14624
votes: 88


You may want to translate the German if you can't read it, but here's one supposed solution to using jQuery with AdSense which is a year old so who knows if it still works:
[software-solutions-juergens.com...]

Whether it's permitted or not is another question, but it seems technically doable.
5:18 am on July 8, 2012 (gmt 0)

Preferred Member

10+ Year Member

joined:Dec 12, 2004
posts:608
votes: 1


That solution moves the adsense iframe. If the OP meant that, I stand corrected. Otherwise, Adsense code uses document.write and AFAIK it's not possible to append it with jquery.