@juanjosegongi/vue-mouseflow
Version:
Vue.js plugin to add Mouseflow tracking to your application
2 lines (1 loc) • 1.04 kB
JavaScript
(()=>{var c=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(o,t)=>(typeof require!="undefined"?require:o)[t]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var i=c("vue"),n=Symbol();var r={createMfq:function(){window._mfq=window._mfq||[]},addTrackingScript:function(e){let o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src="//cdn.mouseflow.com/projects/"+e+".js",document.getElementsByTagName("head")[0].appendChild(o)},install:function(e,o){if(!o||!o.tracking_key)throw new Error("No Mouseflow options specified.");this.createMfq(),this.addTrackingScript(o.tracking_key);let t={push:this.push,logRouteChange:this.logRouteChange};e.config.globalProperties.$mf=t,e.provide(n,t)},push:function(...e){window._mfq.push([...e])},logRouteChange:function(e,o){let t=(o||{}).includeRouteParams===!1?e.matched[e.matched.length-1].path:e.fullPath;this.push("newPageView",t)}},f=r;})();