I am thinking about an online advertisement project based on click payment(ppc: pay per click).
you know about these systems. when you open an account in such system in your account space
there is a code generated and you copy it and paste it to your website HTML code.ads will appear in your pages.this is my Question: How these ad systems work? actually how they(system developers) track number of clicks on a certain ad in publishers pages?
exactly what is in code generated for publishers?
I thought that we can do it with HTTP generic handler class and determine ad url like this: www.site.com/adurl.ashx?ID=123
when user clicks on an ad, then adurl.ashx class will fetch ad properties according to ID and count click number and redirect user to original ad url.
it works! but when I saw generated codes in real sytems there is not look like my simple code. which technology should i use? can you help me?

"How to get exxed from search engine results"
"How to lose customers"
"How to avoid repeat visitors"

alternate titles to this thread,