forked from JoinColony/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpiwik.js
15 lines (14 loc) · 1.67 KB
/
piwik.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
// TODO: See https://github.com/PiwikPRO/react-piwik-pro/issues/12
// import PiwikPro from '@piwikpro/react-piwik-pro';
if (process.env.NODE_ENV === 'production' && ExecutionEnvironment.canUseDOM) {
// PiwikPro.initialize('e148fd00-4e1e-4684-b4c2-146a211d8fee', 'https://colony.containers.piwik.pro');
(function(window, document, dataLayerName, id) {
window[dataLayerName]=window[dataLayerName]||[],window[dataLayerName].push({start:(new Date).getTime(),event:"stg.start"});var scripts=document.getElementsByTagName('script')[0],tags=document.createElement('script');
function stgCreateCookie(a,b,c){var d="";if(c){var e=new Date;e.setTime(e.getTime()+24*c*60*60*1e3),d="; expires="+e.toUTCString()}document.cookie=a+"="+b+d+"; path=/"}
var isStgDebug=(window.location.href.match("stg_debug")||document.cookie.match("stg_debug"))&&!window.location.href.match("stg_disable_debug");stgCreateCookie("stg_debug",isStgDebug?1:"",isStgDebug?14:-1);
var qP=[];dataLayerName!=="dataLayer"&&qP.push("data_layer_name="+dataLayerName),isStgDebug&&qP.push("stg_debug");var qPString=qP.length>0?("?"+qP.join("&")):"";
tags.async=!0,tags.src="https://colony.containers.piwik.pro/"+id+".js"+qPString,scripts.parentNode.insertBefore(tags,scripts);
!function(a,n,i){a[n]=a[n]||{};for(var c=0;c<i.length;c++)!function(i){a[n][i]=a[n][i]||{},a[n][i].api=a[n][i].api||function(){var a=[].slice.call(arguments,0);"string"==typeof a[0]&&window[dataLayerName].push({event:n+"."+i+":"+a[0],parameters:[].slice.call(arguments,1)})}}(i[c])}(window,"ppms",["tm","cm"]);
})(window, document, 'dataLayer', 'e148fd00-4e1e-4684-b4c2-146a211d8fee');
}