views:

129

answers:

1

Hey, I am trying to further my knowledge of javascript and was wondering if anyone could explain to me what exactly is happening in the script below:

<– Begin Google Adsense code –>
<script type=”text/javascript”>
google_ad_client = “ad-client-code-goes-here”;
google_ad_slot = “ad-slot-code-goes-here”;
google_ad_width = 300;
google_ad_height = 250;
</script>
<script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”&gt;
</script>
<– End Google Adsense code –>

Most importantly, why are there 4 'google_ ad_ ...' at the beginning and what is the purpose of them?

A line by line explanation would be awesome :)

Thanks for any help. I really appreciate it.

+2  A: 

The google_ad... are variables (associate this code to your account, set width/height of ad, etc). They're being set for the script (show_ads.js) that will later be loaded.

For a full rundown of the variables, see CyberNAC Javascript Variables used in Adsense.

Jonathan Sampson