Tracking of referring sites from content network

I have been trying to write a PHP routine that would find out what site sent the click and parse out the domain name and match it to a case statement and then apply a tracking ID that corresponds to that URL. In this way, you can determine which sites are making you money and which are not. Then use the exclude feature to remove those that over time are losers.
Has anyone developed a system using PHP to parse out the site, (sometimes it is hidden in googleadsyndication referrer). Also need what variable needs to be sent by google or what variable already exists to parse the domain out of.
This would be extremely useful, since I have tried content site targeting and it really is limited since your ads do not show very often and you pay more. If I could use regular content and determine which of the big sites are not paying off, maybe I could eliminate 30-40% of my click costs and increase ROI.

Tracking of referring sites from content network
Good question. I'm almost positive that somebody has developed this software. Have you tried a Google search yet? I would be shocked if this didn't exist somewhere in the market place.
It wouldn't be too tough to develop. In fact, Optimize My Site uses similar technology to track paid search campaigns.
I'm not too familiar with AdSense parameters, but the first thing you would need to do is examine the referring url. In PHP this is done through the $_SERVER['HTTP_REFERER'] variable.
How far along are you with your script?
Best,
Jeremy
Tracking of referring sites from content network
Thanks for the reply. Not too far along. I found some code that can parse out the xxx.com out of just about any url. Thats about as far as I have gotten.
On a second note, I noticed that if I put a tracking ID on all my keywords in a content campaign, that I can see the different tracking ID's in my log file. What this means is that in content a certain keyword triggers the ad placement (at least it appears so). But then I read in googles help area on content that several keywords are used to determine a page placement on the content network.
My hope of course is that we can turn off words that are not making sales and leave the remaining ones on. Does this make any sense? The content network is a blackbox, but seeing those keywords being triggered and the ID with them sent back to my log file has me intrigued as to whether this info can be used.
What are your thoughts on this?
Tracking of referring sites from content network
The content network is a tough nut to crack. I know some affiliates who use it successfully, but the majority of people I have consulted with lose money.
Trying to predict when/where/what keywords are triggered is tough. Google has improved the network, giving advertisers more control over their ads, however, it's still hard to understand the users motivation for clicking on your ad.