var _debug=false;jQuery(document).ready(function($){jQuery('.literature-pdf').click(function(e){var classes=jQuery(this).attr('class').replace('literature-pdf','').trim();if(classes!=''){var linktitle=jQuery(this).html();RegisterEvent('PDF','Download',classes+" "+linktitle,1)}});var mpid=$('#HfMarketingProjectId');if(mpid.length>0&&mpid.val()!=''){RegisterMpid(mpid.val());} function RegisterMpid(mpid){RegisterEvent('Marketing Project Id','Page Viewed',mpid,null);} $.each($('.tracked'),function(index,tracked){tracked=$(tracked);var category=tracked.data('gaCategory');var action=tracked.data('gaAction');var label=tracked.data('gaLabel');var value=parseInt(tracked.data('gaValue'));if(typeof category!='undefined'&&typeof action!='undefined'&&typeof label!='undefined'&&typeof value!='undefined'){var url=tracked.data('url');RegisterEventWithCallback(category,action,label,value,function(){Debug('callback function called');if(typeof url!='undefined'){window.location.replace(url);}});}});function RegisterEvent(category,action,label,value){if(AnalyticsEnabled()){Debug('registering event, category: '+category+' action: '+action+' label: '+label+' value: '+value);if(value==null){ga('send','event',category,action,label,{'nonInteraction':1});ga('newTracker.send','event',category,action,label,{'nonInteraction':1});}else{ga('send','event',category,action,label,value,{'nonInteraction':1});ga('newTracker.send','event',category,action,label,value,{'nonInteraction':1});}}} function RegisterEventWithCallback(category,action,label,value,func){if(AnalyticsEnabled()){Debug('registering event, category: '+category+' action: '+action+' label: '+label+' value: '+value);if(value==null){Debug('registering event without value');ga('send',{'hitType':'event','eventCategory':category,'eventAction':action,'eventLabel':label,'nonInteraction':true});ga('GlobalTracker.send',{'hitType':'event','eventCategory':category,'eventAction':action,'eventLabel':label,'nonInteraction':true,'hitCallback':func});}else{Debug('registering event with value: '+value);ga('send',{'hitType':'event','eventCategory':category,'eventAction':action,'eventLabel':label,'eventValue':value,'nonInteraction':true});ga('GlobalTracker.send',{'hitType':'event','eventCategory':category,'eventAction':action,'eventLabel':label,'eventValue':value,'nonInteraction':true,'hitCallback':func});}}} function AnalyticsEnabled(){var enabled=typeof ga!=='undefined';Debug(enabled?'analytics is available':'analytics is not available');return enabled;} function Debug(message){if(_debug){console.log('[ANALYTICS] '+message);}}});