How to add a Script to Mendix application using javaaction/microflow/nanoflow ?

1
Below script is for application called mixpanel. We would like to define event/button tracking in mendix.Please share steps on how to add this script to all pages. Thanks.   SCRIPT: <script>(function(c,a){if(!a.__SV){var b=window;try{var d,m,j,k=b.location,f=k.hash;d=function(a,b){return(m=a.match(RegExp(b+"=([^&]*)")))?m[1]:null};f&&d(f,"state")&&(j=JSON.parse(decodeURIComponent(d(f,"state"))),"mpeditor"===j.action&&(b.sessionStorage.setItem("_mpcehash",f),history.replaceState(j.desiredHash||"",c.title,k.pathname+k.search)))}catch(n){}var l,h;window.mixpanel=a;a._i=[];a.init=function(b,d,g){function c(b,i){var a=i.split(".");2==a.length&&(b=b[a[0]],i=a[1]);b[i]=function(){b.push([i].concat(Array.prototype.slice.call(arguments, 0)))}}var e=a;"undefined"!==typeof g?e=a[g]=[]:g="mixpanel";e.people=e.people||[];e.toString=function(b){var a="mixpanel";"mixpanel"!==g&&(a+="."+g);b||(a+=" </script>
asked
1 answers
2

Hi Atul, 

You could do this two ways.

  1. You could add this script to index.html under your theme folder
  2. or Use javascript snippet widget. Add the widget in one of your top layouts and add this script.
answered