Skip to content

Instantly share code, notes, and snippets.

@codecandies
Created October 8, 2013 12:52
Show Gist options
  • Save codecandies/6884211 to your computer and use it in GitHub Desktop.
Save codecandies/6884211 to your computer and use it in GitHub Desktop.
Ausschnitt aus http://static.zeit.de/static/js/loader.js Klicktracking Beispiel
// Ausschnitt aus http://static.zeit.de/static/js/loader.js
// Aufruf like: ZEIT.clickIVW( true );
var ZEIT = function() {
return {
clickCC: function () { // loads 1 pixel for internal click counter
// http://cc.zeit.de/cc.gif?banner-channel=kultur/film/gallery&r='+escape(document.referrer)+'&rand='+Math.random()*10000000000000000
var ccimg = document.createElement('img');
var bc = jQuery("body").attr('data-banner_channel') || "";
var src = 'http://cc.zeit.de/cc.gif?banner-channel=' + bc + '&r=' + escape(document.referrer) + '&rand=' + Math.random()*10000000000000000;
ccimg.src = src;
},
clickIVW: function ( internalcounter ) { // loads 1 IVW-Counting Pixel
if(window.Z_IVW_RESSORT !== undefined) {
var click = jQuery("<img>").attr("src", 'http://zeitonl.ivwbox.de/cgi-bin/ivw/CP/'+window.Z_IVW_RESSORT+';?r='+escape(document.referrer)+'&d='+Math.random()*100000).width(1).height(1).addClass('ivw-aja-pixel');
if( internalcounter ) {
ZEIT.clickCC();
}
}
},
clickIVWSpecial: function ( id ) { // loads 1 IVW-Counting Pixel
//Spezialfunktion für (vorerst) HTML5 Videoplayer, übergibt ID String, statt Ressorterkennung zu nutzen
var click = jQuery("<img>").attr("src", 'http://zeitonl.ivwbox.de/cgi-bin/ivw/CP/'+id+';?r='+escape(document.referrer)+'&d='+Math.random()*100000).width(1).height(1).addClass('ivw-aja-pixel');
},
clickWebtrekk: function (mode) { // sends a click to webtrekk via wt_sendinfo function and to ga via gaq push
ZEIT.clickWebtrekkOnly( mode );
ZEIT.clickGA( ['_trackEvent', mode, "click"] );
},
clickWebtrekkOnly: function ( linkId ) {
if( typeof linkId == 'undefined') return;
if( window.wt !== undefined ) {
if( window.wt.sendinfo !== undefined ) window.wt.sendinfo({linkId: linkId});
}
},
clickGA: function( ga_array ) {
if(window._gaq !== undefined ) {
_gaq.push( ga_array );
}
}
};
}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment