Pass variablke from a js file to PHP

I wish to know how a variable from a javascript file can be passed to PHP?


<script type="text/javascript"><!--
google_ad_client = "ca-pub-1234567890123456";
/* snipet_name */
google_ad_slot = "123456789";
google_ad_width = 728;
google_ad_height = 90;
//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

This is a google adsense script sample, and I’ll like to know how are passed the id’s to a server database. How are generated the links based on those id’s(google_ad_client and google_ad_slot)?

Maybe my question isn’t clear just because I don’t see how the service works from the programming point of view.

PS: I don’t try to replicate or to hack google adsense service but I’m curious about how it works.

Take a look at the embedded code from http://pagead2.googlesyndication.com/pagead/show_ads.js and you might spot how that js file builds a url, then, though I did not stop to figure it out fully, JS can open a new window or iframe with your google_ad_client as one of the GET arguments.

I’d guess this is how they are doing it.