/* trak.js v0.5.4 | (c) 2016 @mrmartineau | https://github.com/mrmartineau/trak.js Universal event tracking API. */ var trak=function(){"use strict";var a=function(a){return a?trak.options.clean?d.call(this,a).toString().replace(/\s|'|"/g,f.delimeter).toLowerCase():d.call(this,a):""},b=function(b){var c=e(b),d=a.call(this,c.category),g=a.call(this,c.action),h=a.call(this,c.label),i=c.eventName,j=c.value,k=c.nonInteraction;"ga"===f.trackType&&"undefined"!=typeof ga?ga("send","event",d,g,h,j,{nonInteraction:k}):"_gaq"===f.trackType&&"undefined"!=typeof _gaq?_gaq.push(["_trackEvent",d,g,h,j]):"gtm"===f.trackType&&"undefined"!=typeof dataLayer&&dataLayer.push({event:i,eventCategory:d,eventAction:g,eventLabel:h,eventValue:j,eventNonInteraction:k}),void 0!==f.additionalTypes&&f.additionalTypes(c),f.debug&&console.debug("Debug message:\n Category:",d,"\n Action:",g,"\n Label:",h)},c=function(){var a=null!==this.getAttribute("data-trakwithjs")?!0:!1;if(!a){var c=JSON.parse(this.getAttribute("data-trak"));b.call(this,c)}},d=function(a){var b;switch(a){case"page.title":b=document.title;break;case"page.href":b=window.location.href;break;case"link.href":b=this.href;break;case"link.title":b=this.title;break;case"referrer":b=document.referrer?document.referrer:"No referrer";break;default:b=a}return b},e=function(a){return{category:a&&a.category||"",action:a&&a.action||"",label:a&&a.label||"",value:a&&a.value||0,nonInteraction:a&&a.nonInteraction||!1,eventName:a&&a.eventName||void 0}},f={clean:!0,delimeter:"_",trackType:"ga",additionalTypes:void 0,debug:!1},g=function(){for(var a=document.querySelectorAll("[data-trak]"),b=0;b