Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

how does yahoos javascript Conversion Counter work?

I don't understand the following javascript code nor how it could possibly have the conversion data. Does it record an ip address? I'm not a javascript programmer and would appreciate any help.

<SCRIPT LANGUAGE="JavaScript">
<!-- Overture Services Inc. 07/15/2003
var cc_tagVersion = "1.0";
var cc_accountID = "2079408136";
var cc_marketID = "0";
var cc_protocol="http";
var cc_subdomain = "convctr";
if(location.protocol == "https:")
{
cc_protocol="https";
cc_subdomain="convctrs";
}
var cc_queryStr = "?" + "ver=" + cc_tagVersion + "&aID=" + cc_accountID + "&mkt=" + cc_marketID +"&ref=" + escape(document.referrer);
var cc_imageUrl = cc_protocol + "://" + cc_subdomain + ".overture.com/images/cc/cc.gif" + cc_queryStr;
var cc_imageObject = new Image();
cc_imageObject.src = cc_imageUrl;
// -->
</SCRIPT>
[921 byte] By [ericShawnSentry] at [2007-11-11 7:12:16]
# 1 Re: how does yahoos javascript Conversion Counter work?
I can't really tell what this JavaScript is doing, other than to create an image based upon a specified url. I don't even know what the "conversion data" you refer to is.

What I can determine, based upon the code, is that the QueryString (cc_queryStr) in the url (cc_imageUrl) is processed by the overture.com site and an image is returned to the page. The overture.com page is receiving a version, account ID, market ID and the referrer (which is the url of the document containing the link that brought the browser to the current document - if available).
pclement at 2007-11-11 23:35:07 >
# 2 Re: how does yahoos javascript Conversion Counter work?
A sample URL would look like:
http://convctr.overture.com/images/cc/cc.gif?ver=1.0&aID=2079408136&mkt=0&ref=http://blahblah.com

It is trying to fetch an image based on the parameters passed to it. So, I figure there would be a servlet mapping to a URL pattern like /images/cc/cc/gif, which would read those parameters and generate an image.
Here's a link which provides how servlets generate images (http://www.unix.org.ua/orelly/java-ent/servlet/ch06_01.htm)

I hope I was not off the track!
aniseed at 2007-11-11 23:36:11 >
# 3 Re: how does yahoos javascript Conversion Counter work?
Thanks everyone, that does help a bit. I've since stopped using Yahoo Sponsored Search anyway because it is SO expensive and in a month hasn't converted a single visitor to sales.
ericShawnSentry at 2007-11-11 23:37:05 >