From a03fe403cca3428ee8afdeb2ee14c356d3490860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Grz=C4=85ba?= Date: Wed, 13 Dec 2023 21:54:52 +0100 Subject: [PATCH 1/2] ignore ide jetbrains files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 7005be7..373060a 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,6 @@ dist npm-debug.log* yarn-debug.log* yarn-error.log* + +# ide +.idea From 38444cca2a836e6b0fa8129a6d78c4241ff2f8c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Grz=C4=85ba?= Date: Wed, 13 Dec 2023 21:56:03 +0100 Subject: [PATCH 2/2] [PPI-690] tag manager snippet updated --- src/core/index.ts | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/core/index.ts b/src/core/index.ts index 761bb8c..a609325 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -1,36 +1,38 @@ -import { PiwikProWindow } from "../interfaces/piwikpro.window"; +import { PiwikProWindow } from '../interfaces/piwikpro.window' function init(containerId: string, containerUrl: string, nonce?: string) { if (!containerId) { - console.error('Empty tracking code for Piwik Pro.'); - return; + console.error('Empty tracking code for Piwik Pro.') + return } if (!containerUrl) { - console.error('Empty tracking URL for Piwik Pro.'); - return; + console.error('Empty tracking URL for Piwik Pro.') + return } if (!document) { - console.error('Was not possible to access Document interface. Make sure this module is running on a Browser w/ access do Document interface.'); + console.error( + 'Was not possible to access Document interface. Make sure this module is running on a Browser w/ access do Document interface.' + ) } - const s: HTMLScriptElement = document.createElement('script'); - s.async = false; + const s: HTMLScriptElement = document.createElement('script') + s.async = false if (nonce) { - s.setAttribute("nonce", nonce); + s.setAttribute('nonce', nonce) } s.text = `(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=/"} +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();f="; SameSite=Strict"}document.cookie=a+"="+b+d+f+"; 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="${containerUrl}/containers/"+id+".js"+qPString,scripts.parentNode.insertBefore(tags,scripts); +tags.async=!0,tags.src="${containerUrl}/"+id+".js"+qPString,scripts.parentNode.insertBefore(tags,scripts); !function(a,n,i){a[n]=a[n]||{};for(var c=0;c