/* 
 * jsHub open source tagging
 *
 * Custom plugin for Causata.com
 * Prepared by Causata consulting
 */
"use strict";(function(){var b={name:"Causata custom page data plugin",id:"causata.com-custom",version:1,vendor:"Causata consulting",type:"data-capture"};jsHub.trigger("plugin-initialization-start",b);b.eventHandler=function a(c){var f=c.data,j=c.type,g,l=document.location;if(typeof f["page-name"]!=="string"){var k,m=document.getElementsByTagName("link"),h;for(var e=0;e<m.length;e++){k=m[e];if(k.getAttribute("rel")==="canonical"){g=k.getAttribute("href");}}if(!g){g=l.pathname;}}if(g==="/error/404"){jsHub.trigger("error-404");}if(l.host.match(/^blog\.causata\.com$/)!==null){g="/blog"+g;if("page-view"===j&&l.pathname!=="/"&&typeof $==="function"){var d=new Date($("#date-header")[0]);if(!isNaN(d.getTime())){f["pub-date"]=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();}}}f["page-name"]=g;f["page-title"]=document.title.replace(/^Blog – Causata: /,"").replace(/ - Causata$/,"");if(typeof $==="function"){h=$("a[rel=tag]");if(h.size()>0){h=h.map(function(){return $(this).text();});f.label=$.makeArray(h);}}if("site-exit"===j){f["external-url"]=f.url;}if("download"===j){f["download-name"]=f.url.replace(/.+\//,"");}if("page-view"===j){f["page-referrer"]=f.referrer;f["screen-resolution"]=f.sW+"x"+f.sH;f["window-resolution"]=f.wW+"x"+f.wH;}return f;};jsHub.bind("page-view",b);jsHub.bind("video-play",b);jsHub.bind("download",b);jsHub.bind("site-exit",b);jsHub.trigger("plugin-initialization-complete",b);}());
