How Adsense Scripts Works

Do you wonder how Google Adsense scripts work. I mean this is just script, how can shows up relevant ads to our website.

I'll try to explain the secret of Google Adsense Scriptsshow_ads.js

Before we continue, it's important to you understand this article for education only, not for hacking Google Adsense Scripts. You break ToS GA if you do that. We are on the same page now ? Ok good.

Google Adsense Script (show_ads.js) maybe protected by Obfuscator to make the script hard to read. I need a lot of time to reformat script and rename variabel based on my logic.

How Google Adsense Scripts work ?


(script type="text/javascript")(!--
google_ad_client = "pub-71209491204xxxxx";
google_ad_width = 180;
google_ad_height = 150;
google_ad_format = "180x150_as";
google_cpa_choice = "CAEQyvTH1QMaCLmcVsXlpQobKILJ0s0BMAA";
//--)
(/script)
(script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript")
(/script)

Notes : I've changed <> to () to prevent ads shows up in this post.


Look at script beginning with "google_" thats is parameter sent to show_ads.js to build a large query string to server, and server returning back by showing ads. By default you can't modify script unless you are premium publisher like slasdot.org.
There is no different script between premium publisher and normal publisher, we using the same script, show_ads.js. The different is normal publisher DISALLOWED to use all parameter in show_ads.js

The complete parameter of Adsense script, show_ads.js













































































































































































Parameter Description
google_ad_client Your Adsense publisher id
google_ad_output By default is "html". Other value is "js" or "textlink"
google_ad_host 3rd party host. Sharing your revenue with them. For example if you publish your adsense code using blogger service by adding widget then you will sharing revenue with blogger.com
google_ad_channel Channel, for tracking performance your ads
google_ad_region I don't know yet. Somebody tell me
google_ad_section Focusing Google crawl or bot to showing ads inside tag google_ad_section_start and google_ad_section_end
google_ad_type Format of your ads, it can be "text", "image" or "text_image"
google_ad_override I don't know yet. Somebody tell me
google_alternate_ad_url Alternate url if PSA (Public Service Ads) shows up
google_alternate_color Fill with color if PSA (Public Service Ads) shows up
google_cpa_choice The referral id you choose
google_ad_override I don't know yet. Somebody tell me
google_country Country
google_city City
google_safe slashdot.org using it. But i don't know yet
google_country Country
google_hints I don't know yet. Somebody tell me
google_encoding Probably encode referral id ads
google_last_modified_time I don't know yet. Somebody tell me
google_targeting I don't know yet. Somebody tell me
google_max_num_ads Sets maximum ads. I've seen some site can shows 10 content ads. But this is against Adsense ToS
google_page_url Our website url maybe ?
google_color_bg Background color
google_color_text Teks color
google_color_link Link color
google_color_url Url color
google_color_border Border color
google_color_line Line color
google_kw_type I don't know yet. Somebody tell me
google_targeting I don't know yet. Somebody tell me
google_language Someone said, if your website not using english then set "google_language = en", to prevent PSA shows up, but of course this against Adsense ToS
google_feedback Feedback link
google_page_location Maybe location where ads shows up
google_cust_age Your profile
google_gender Your profile
google_cust_interests Your profile
google_cust_idid Your profile
google_cust_job Your profile
google_cust_u_url Your profile
google_cust_lh Your profile
google_cust_ch Your profile
google_ed I don't know yet. Somebody tell me


I can't explain all parameter, it will help me if someone share to me.

PS : I don't know why blank space appears before table. Probably Blogger bugs