/* * Gepackt mit http://refresh-sf.com/yui/ * * Einstellungen: * Type = js * Preserve unnecessary semicolons = checked */ function md5(C){var D;var w=function(b,a){return(b<>>(32-a));};var H=function(k,b){var V,a,d,x,c;d=(k&2147483648);x=(b&2147483648);V=(k&1073741824);a=(b&1073741824);c=(k&1073741823)+(b&1073741823);if(V&a){return(c^2147483648^d^x);}if(V|a){if(c&1073741824){return(c^3221225472^d^x);}else{return(c^1073741824^d^x);}}else{return(c^d^x);}};var r=function(a,c,b){return(a&c)|((~a)&b);};var q=function(a,c,b){return(a&b)|(c&(~b));};var p=function(a,c,b){return(a^c^b);};var n=function(a,c,b){return(c^(a|(~b)));};var u=function(W,V,aa,Z,k,X,Y){W=H(W,H(H(r(V,aa,Z),k),Y));return H(w(W,X),V);};var f=function(W,V,aa,Z,k,X,Y){W=H(W,H(H(q(V,aa,Z),k),Y));return H(w(W,X),V);};var F=function(W,V,aa,Z,k,X,Y){W=H(W,H(H(p(V,aa,Z),k),Y));return H(w(W,X),V);};var t=function(W,V,aa,Z,k,X,Y){W=H(W,H(H(n(V,aa,Z),k),Y));return H(w(W,X),V);};var e=function(V){var W;var d=V.length;var c=d+8;var b=(c-(c%64))/64;var x=(b+1)*16;var X=new Array(x-1);var a=0;var k=0;while(k>>29;return X;};var s=function(d){var a="",b="",k,c;for(c=0;c<=3;c++){k=(d>>>(c*8))&255;b="0"+k.toString(16);a=a+b.substr(b.length-2,2);}return a;};var E=[],L,h,G,v,g,U,T,S,R,O=7,M=12,J=17,I=22,B=5,A=9,z=14,y=20,o=4,m=11,l=16,j=23,Q=6,P=10,N=15,K=21;C=this.utf8_encode(C);E=e(C);U=1732584193;T=4023233417;S=2562383102;R=271733878;D=E.length;for(L=0;L127&&g<2048){f=String.fromCharCode((g>>6)|192)+String.fromCharCode((g&63)|128);}else{f=String.fromCharCode((g>>12)|224)+String.fromCharCode(((g>>6)&63)|128)+String.fromCharCode((g&63)|128);}}if(f!==null){if(e>b){i+=h.slice(b,e);}i+=f;b=e=d+1;}}if(e>b){i+=h.slice(b,c);}return i;} if (typeof(Adcell) == 'undefined') { var Adcell = {}; } /** * objekt dass informationen aus dem user-rechner auslesen kann * @returns {AdcellUser} */ Adcell.User = function () { /** * auf welchem Host ADCELL läuft * * @var string */ var hostname = 'www.adcell.de'; /** * auf welchem Host das ADCELL-Tracking läuft * * @var string */ var trackhostname = 't.adcell.com'; /** * Wurzel Werbemittel-Url * * @var string */ this.promotionBaseUrl = 'https://' + hostname + '/default/promotion/js'; /** * Wurzel Transaction-Url * * @var string */ this.transactionBaseUrl = 'https://' + trackhostname + '/t/embed.js'; /** * Wurzel ETag-Url * * @var string */ this.etagBaseUrl = 'https://' + trackhostname + '/t/et'; /** * Wurzel Legacy Cookie * * @var string */ this.legacyCookieBaseUrl = 'https://' + hostname + '/t/legacyck'; /** * ETag (wird vom Server geholt) * * @var string */ this.etag = ''; /** * ETag (wird vom Server geholt) * * @var string */ this.legacyCookies = {}; /** * Merchant-Parameter * * @var object */ this.paramObj = {}; /** * hält die partnerid des users vor * @var string partnerid */ this.partnerId = ''; /** * ads die dem user angezeigt werden * @var object iserAds */ this.userAds = {}; /** * ermittelt aus diversen vom browser lesbaren rechner-eigenschaften einen MD5 schlüssel * * @returns string */ this.getFingerprint = function () { try { var viewKey = '', i; viewKey += window.screen.availWidth; viewKey += window.screen.availHeight; viewKey += window.screen.colorDepth; viewKey += window.navigator.appCodeName; viewKey += window.navigator.appName; viewKey += window.navigator.appVersion; viewKey += window.navigator.buildID; viewKey += window.navigator.userAgent; viewKey += window.navigator.product; viewKey += window.navigator.platform; viewKey += window.navigator.vendor; viewKey += window.navigator.vendorSub; viewKey += window.navigator.javaEnabled(); for (i = 0; i < window.navigator.mimeTypes.length; i++) { viewKey += window.navigator.mimeTypes[i].description + " = " + window.navigator.mimeTypes[i].type + "(" + window.navigator.mimeTypes[i].suffixes + ")"; } for (i = 0; i < window.navigator.plugins.length; i++) { viewKey += window.navigator.plugins[i].name + ", mimes = " + window.navigator.plugins[i].length; } var languages = window.navigator.languages; if (languages instanceof Array) { viewKey += languages.join(); } viewKey += this.getCanvasFingerprint(); return md5(viewKey); } catch (ex) { return ''; } }; /** * Liest den First-Party-Cookie aus * * @returns {string} */ this.getCookie = function(){ var cookieValue = ''; try { var match = document.cookie.match(new RegExp('(^| )adcell=([^;]+)')); if (match) { cookieValue = match[2]; } } catch (e) { } return encodeURIComponent(cookieValue); }; this.storageAvailable = function(type) { try { var storage = window[type], x = '__storage_test__'; storage.setItem(x, x); storage.removeItem(x); return true; } catch(e) { return e instanceof DOMException && ( e.code === 22 || e.code === 1014 || e.name === 'QuotaExceededError' || e.name === 'NS_ERROR_DOM_QUOTA_REACHED') && storage.length !== 0; } }; this.getStorageData = function(){ var storageValue = ''; var storageType = 'localStorage'; if(this.storageAvailable(storageType)){ var storage = window[storageType]; var result = storage.getItem('adcell'); if(result !== null){ storageValue = result; } } return encodeURIComponent(storageValue); }; this.isCanvasSupported = function(){ var canvas = document.createElement('canvas'); return !!(canvas.getContext && canvas.getContext('2d')); }; this.getCanvasFingerprint = function(){ var fp = 'nocanvas'; if(this.isCanvasSupported()) { var canvas = document.createElement("canvas"); canvas.height = 60; canvas.width = 190; var context = canvas.getContext("2d"); var txt = "ADCELL - Affiliate Marketing"; context.textBaseline = "top"; context.font = "14px 'Arial'"; context.textBaseline = "alphabetic"; context.fillStyle = "#00FF1A"; context.fillRect(50,1,70,23); context.fillStyle = "#069"; context.fillText(txt, 2, 15); context.fillStyle = "rgba(0, 111, 255, 0.7)"; context.fillText(txt, 6, 20); context.save(); context.fillStyle = "rgba(255, 68, 111, 0.9)"; context.translate(60, 20); context.rotate(-Math.PI/7); context.textAlign = "center"; context.fillText(txt, 10, 10); context.restore(); fp = canvas.toDataURL("image/png"); } return fp; }; this.getEtag = function () { return this.etag; }; this.getLegacyCookies = function() { var legacyCookies = ''; var cookieKeys = Object.getOwnPropertyNames(this.legacyCookies); for (var cookieKeyIndex = 0; cookieKeyIndex < cookieKeys.length; cookieKeyIndex++) { var cookieKey = cookieKeys[cookieKeyIndex]; legacyCookies += '&lck[' + cookieKey + ']=' + encodeURIComponent(this.legacyCookies[cookieKey]); } return legacyCookies; }; /** * fügt eine werbung zum user hinzu, setzt den fp und gibt das ad-objekt zurück * * @param {AdcellUserAd} ad * @returns AdcellUserAd */ this.addAd = function (ad) { ad.setFingerprint(this.getFingerprint()); this.userAds[ad.getBid()] = ad; return ad; }; /** * setzt die partnerid * * @param {string} partnerId */ this.setPartnerId = function (partnerId) { this.partnerId = partnerId; }; /** * holt ein werbemittel von adcell dynamisch * * obj kann folgende Eigenschaften haben: * string wid: Id des Werbemittels. * Erster Teil der ehemaligen "bid=1234-5678-abcd" * string partnerId: optionale Id des Kunden. * Zweiter Teil der ehemaligen "bid=1234-5678-abcd" * kann global mit "Adcell.user.setPartnerId('5678');" gesetzt werden * string subid: optionaler String der ein genaueres Tracken von Transaktionen ermöglicht * Dritter Teil der ehemaligen "bid=1234-5678-abcd" * string id : optionale ID des DOM-Elements in welches das Werbemittel eingefügt wird, * ohne id wird das Werbemittel an der Stelle des Aufrufs mit document.write ausgegeben * * @param object obj */ this.getAd = function (obj) { var idString = ''; if (typeof (obj.id) != "undefined") { idString = encodeURIComponent(obj.id); } var subidString = ''; if (typeof (obj.subid) !== "undefined") { subidString = encodeURIComponent(obj.subid); } var partnerId = this.partnerId; if (typeof (obj.partnerId) !== "undefined") { partnerId = encodeURIComponent(obj.partnerId); } var text = ''; if (typeof (obj.text) !== "undefined") { text = encodeURIComponent(obj.text); } var param0 = ''; if (typeof (obj.param0) !== "undefined") { param0 = encodeURIComponent(obj.param0); } var target = ''; if (typeof (obj.target) !== "undefined") { target = encodeURIComponent(obj.target); } var script = document.createElement('script'); script.setAttribute('type', 'text/javascript'); var url = this.promotionBaseUrl; if (typeof (obj.forward) !== "undefined") { url += '/forward/1'; } if (typeof (obj.dataKey) !== "undefined") { url += '/dataKey/' + obj.dataKey; } if (typeof (obj.pv) !== "undefined") { url += '/pv/1'; } if (typeof (obj.encodingId) !== "undefined") { url += '/encodingId/' + encodeURIComponent(obj.encodingId); } else { url += '/promoId/' + encodeURIComponent(obj.wid); url += '/slotId/' + partnerId; } if (subidString.length > 0) { url += '/subId/' + subidString; } if (idString !== '') { url += '/id/' + idString; } else { var key = md5(Math.random()); window.document.write(''); url += '/childId/' + key; } if (text !== '') { url += '/text/' + text; } if (target !== '') { url += '/target/' + target; } if (param0 !== '') { url += '?param0=' + param0; } script.setAttribute('src', url); document.getElementsByTagName("head")[0].appendChild(script); }; /** * Aufruf eines Adservers * * @parameter object obj * @return void */ this.getAdserver = function (obj) { var script = document.createElement('script'); var url = this.promotionBaseUrl + 'adserver?'; url += 'adserverId=' + obj.adserverId; if (typeof (obj.id) != "undefined") { idString = encodeURIComponent(obj.id); } if (idString !== '') { url += '&id=' + idString; } else { var key = md5(Math.random()); window.document.write(''); url += '&childId=' + key; } var target = ''; if (typeof (obj.target) != "undefined") { target = encodeURIComponent(obj.target); } if (target !== '') { url += '&target=' + target; } else { url += '&target=_blank'; } url += '&t=' + Math.round(1000000 * Math.random()); script.setAttribute('type', 'text/javascript'); script.setAttribute('src', url); document.getElementsByTagName("head")[0].appendChild(script); }; this.getUrlParams = function(obj){ var params = ''; for(var key in obj){ var param = key + '=' + encodeURIComponent(obj[key]); var separator = (params !== '') ? '&' : '?'; params += separator + param; } return params; }; this.send = function(ajaxConfig){ var scope = this; var url = ajaxConfig.path + this.getUrlParams(ajaxConfig.params); var xhr = new XMLHttpRequest(); xhr.open('GET', url); xhr.timeout = 5000; xhr.withCredentials = true; xhr.onerror = function () { if (typeof ajaxConfig.errorCallback === 'function') { ajaxConfig.errorCallback(xhr, scope); } }; xhr.onload = function(){ if(typeof ajaxConfig.successCallback === 'function') { ajaxConfig.successCallback(xhr, scope); } }; xhr.ontimeout = function () { if (typeof ajaxConfig.errorCallback === 'function') { ajaxConfig.errorCallback(xhr, scope); } }; xhr.send(); }; /** * tracken einer Transaktion * * @param {object} obj */ this.track = function (obj) { this.paramObj = obj; var ajaxConfig = { path: this.etagBaseUrl, params: {}, successCallback: this.eTagSuccessCallback, errorCallback: this.eTagErrorCallback, scope: this }; this.send(ajaxConfig); }; this.checkLegacyCookies = function(scope) { var programId = scope.paramObj['pid'] || ''; programId = parseInt(programId, 10); var ajaxConfig = { path: scope.legacyCookieBaseUrl, params: { programId: programId }, successCallback: scope.legacyCookieSuccessCallback, errorCallback: scope.legacyCookieErrorCallback, scope: scope }; this.send(ajaxConfig); }; this.callTrack = function(scope) { var obj = this.paramObj; var params = ''; for (var param in obj) { params += '&' + encodeURIComponent(param) + '=' + encodeURIComponent(obj[param]); } var script = document.createElement('script'); script.setAttribute('type', 'text/javascript'); script.setAttribute('src', this.transactionBaseUrl + '?' + params); document.getElementsByTagName("head")[0].appendChild(script); }; this.legacyCookieSuccessCallback = function(xhr, scope) { try { var response = xhr.responseText; scope.legacyCookies = JSON.parse(response); } catch (ex) {} scope.callTrack(scope); }; this.legacyCookieErrorCallback = function(xhr, scope) { scope.callTrack(scope); }; this.eTagSuccessCallback = function (xhr, scope) { scope.etag = xhr.getResponseHeader('ETag'); scope.checkLegacyCookies(scope); }; this.eTagErrorCallback = function (xhr, scope) { scope.checkLegacyCookies(scope); }; }; /** * zuständig für die Rückgabe des Werbemittels * * @param {string} bid * @returns {AdcellUserAd} */ Adcell.Ad = function (bid) { this.bid = bid; /** * MD5fp des users * @var string */ this.fingerprint = ''; /** * dieser string wird im ad-code durch den fp ersetzt * @var string */ this.fingerprintPlaceholder = '@@fp@@'; /** * quellcode des ads * @var string */ this.code = ''; /** * setzt den fingerprint für das ad * @param {string} newFingerprint */ this.setFingerprint = function (newFingerprint) { this.fingerprint = newFingerprint; }; /** * leert den code * notwendig bei mehreren ad-aufrufen */ this.resetCode = function () { this.code = ''; }; /** * setzt den code des ads * achtung - js kann nur einzeilige strings - string muss also vorbereitet werden * @param {string} newCode */ this.setCode = function (newCode) { this.code = newCode; }; /** * fügt eine zeile an den ad-code an * @param {string} codeLine */ this.addCodeLine = function (codeLine) { this.code += codeLine; }; /** * ausgabe des code. * wenn eine id gesetzt, dann in das element hinein, andernfalls direkte ausgabe * @param {string} id * * @todo use document.createElement() ? */ this.print = function (id) { this.code = this.injectFingerPrint(this.code); if (typeof (id) != "undefined" && document.getElementById(id) !== null) { document.getElementById(id).innerHTML = this.code; } else { document.getElementsByTagName("body")[0].innerHTML = document.getElementsByTagName("body")[0].innerHTML + "\n" + this.code; } }; /** * Rückwärtskompatibilität * * @return void */ this.printChild = function (childId) { return this.print(childId); }; /** * hilfsfunktion zum ersetzen des fingerprint im adcode. * in den adcode muss man nur "@@fp@@" schreiben um dort stattdessen den echten code "&fp=244534534" zu erhalten * @param {string} input Eingabe * @returns string */ this.injectFingerPrint = function (input) { var search = this.fingerprintPlaceholder; var replace = '&fp=' + encodeURIComponent(this.fingerprint); var subject = input; var count = false; /* ab hier: inhalt der funktion str_replace aus phpjs */ var i = 0, j = 0, temp = '', repl = '', sl = 0, fl = 0, f = [].concat(search), r = [].concat(replace), s = subject, ra = r instanceof Array, sa = s instanceof Array; s = [].concat(s); if (count) { this.window[count] = 0; } for (i = 0, sl = s.length; i < sl; i++) { if (s[i] === '') { continue; } for (j = 0, fl = f.length; j < fl; j++) { temp = s[i] + ''; repl = ra ? (r[j] !== undefined ? r[j] : '') : r[0]; s[i] = (temp).split(f[j]).join(repl); if (count && s[i] !== temp) { this.window[count] += (temp.length - s[i].length) / f[j].length; } } } return sa ? s : s[0]; }; this.getBid = function () { return this.bid; }; }; Adcell.user = new Adcell.User(); Adcell.user.track({ 'pid': '2071', 'eventid': '2278', 'referenz': '', 'betrag': '0', 'eventId': '2278', 'programId': '2071', 'basket': '0', 'reference': '' });