/*
* WebCollector Base Script
* (c) 2005, 2006, Contentmetrics GmbH
* $$Header: /home/cvs/wcadmin/Ressourcen/wcol_src.js,v 1.14 2006/10/19 13:56:33 axel Exp $$
* $$Revision: 1.14 $$
* $$Log: wcol_src.js,v $
* $Revision 1.14 2006/10/19 13:56:33 axel
* $uuid variable per request setzbar
* $
* $Revision 1.13 2006/10/03 13:05:09 axel
* $Bug in wcol_src.js: Object not found in cImgTag
* $
* $Revision 1.12 2006/07/11 15:46:17 axel
* $wcDebug eingebaut
* $
* $Revision 1.11 2006/04/14 23:14:57 axel
* $*** empty log message ***
* $
* $Revision 1.10 2006/04/14 23:14:33 axel
* $Header CVS werden nicht ersetzt (ich krieg die Krise)
* $$
*/
// Debugger Hook
function WCol_Debugger()
{
this.registeredObjects = new Array();
this.register = new Function('obj', 'this.registeredObjects.push(obj);');
this.getObjects = new Function('return (this.registeredObjects);');
this.temp = ''
+ 'var w = 600;'
+ 'var h = 700;'
+ 'var y = (screen.height / 2) - (h/2);'
+ 'var x = (screen.width / 2) - (w/2);'
+ "var bb = window.open('','','width=' + w + ',height=' + h + ',location=0,menubar=1,status=1,toolbar=0,resizable=1,scrollbars=1');"
+ 'bb.moveTo(x,y);'
+ "var turl = 'http://webcollector.de/debugger/wcdebug.jsp';"
+ 'bb.document.open();'
+ 'bb.document.write(\'\');'
+ 'bb.document.write(\'\');'
+ 'bb.focus();'
+ '';
this.wcDebug = new Function ( this.temp );
}
var _wcol_debugger_hook = new WCol_Debugger();
// constructor for a WebCollector object
function WebCollector(xAccountIds) {
// Version for internal CVS
this.myVersion = "$$Revision: 1.14 $$";
// register this object
_wcol_debugger_hook.register(this);
// placeholder for the image
this.pic = null;
// all names refer to the standard metrics and dims in a datadictionary !!
this.server = "_s";
this.referrer = "_r";
this.url = "_u";
this.accdim = "_a";
this.currency = "_c";
this.userAgent = "_ua";
this.uaShortName = "_us";
this.screenSize = "_sz";
this.colorDepth = "_cd";
this.plugins = "_pi";
this.lang = "_lg";
this.Cookies = "_ce";
this.platform = "_os";
this.java = "_jv";
this.version = "_tv"; // Template Version Code Generation.
this.customUUID = "_uuid";
// General Settings
// leave some query parameters on the url
this.leaveQueryString = false;
// the requested parameters to leave, '*' as a wildcard
this.queryParameters = "";
// subsequent multiple calls in the same page
this.ccount = 0;
this.debug = false;
this.config = new Array();
this.dimensions = new Array();
this.metrics = new Array();
this.genericSetter = new Function("arr", "nam", "val", 'arr[nam] = val;');
this.setDimension = new Function("nam", "val", 'this.genericSetter(this.dimensions, nam, val);');
this.setMetric = new Function("nam", "val", 'this.genericSetter(this.metrics, nam, val);');
this.setConfig = new Function("nam", "val", 'this.genericSetter(this.config, nam, val);');
this.temp = 'this.temp = ai.replace(/\\s+/,\'\').split(",");'
+ 'this.setConfig(this.accdim, ""+this.temp);'
+ 'this.accountids = this.temp;';
this.setAccountIds = new Function("ai", this.temp );
// basic configuration settings
// Account ID for tracking
this.accountids = "";
if ( xAccountIds )
this.setAccountIds(xAccountIds);
this.temp = 'this.url = "http://webcollector.de/wcol";'
+ 'var ts = (new Date()).getTime();'
+ 'this.url += ("/ts" + ts + "." + this.ccount++ + "/" + this.config[this.accdim] + "?[A]");'
+ 'for ( conf in this.config )'
+ '{'
+ ' var val = this.config[conf];'
+ ' if ( val != "" )'
+ ' this.url += ("&c[" + encodeURIComponent(conf) + "]=" + encodeURIComponent(""+val) );'
+ '}'
+ 'for ( dimension in this.dimensions )'
+ '{ '
+ ' var val = this.dimensions[dimension];'
+ ' if ( this.debug) window.alert("(" + typeof(val) + ")" + dimension + "=" + val);'
+ ' if ( val ) {'
+ ' var t = val[0];'
+ ' if ( typeof(val)=="object" && t ) {'
+ ' var dimValues = "";'
+ ' for (i=0;i= 0 ) {'
+ ' temp2 += document.location.search;'
+ ' } else {'
+ ' for ( param in this.queryParameters.split(",") ) '
+ ' {'
+ ' temp2 += "."'
+ ' }'
+ ' }'
+ ' this.setDimension(this.url, temp2);'
+ ' }'
+ '}';
this.init = new Function(this.temp);
// submit request
this.temp = ''
+ 'this.pic = new Image();'
+ 'this.pic.src = this.cUrl();';
this.submitRequest = new Function(this.temp);
// Assign a query Parameter to a Dimension / Metric
this.temp = ''
+ 'var qS = document.location.search;'
+ 'var pV = "";'
+ 'if(qS.length>1) {'
+ ' qS=qS.substr(1);'
+ ' fl=qS.indexOf(key);'
+ ' if(fl != -1) {'
+ ' fl += (key.length + 1);'
+ ' ll=qS.indexOf("&",fl);'
+ ' if(ll == - 1 )'
+ ' ll = qS.length;'
+ ' pV = qS.substring(fl,ll);'
+ ' fl=pV.indexOf("=",0);'
+ ' pV = pV.substring( fl+1 );'
+ ' }'
+ '}'
+ 'return pV;';
this.getQueryParam = new Function("key", this.temp);
this.temp = ''
+ "var val = this.getQueryParam(key);"
+ "this.setDimension(dim, val);"
;
this.getQueryDimension = new Function("dim", "key", this.temp);
this.temp = ''
+ "var val = this.getQueryParam(key);"
+ "this.setMetric(met, val);"
;
this.getQueryMetric = new Function("met", "key", this.temp);
}