@blotoutio/providers-google-analytics-4-sdk
Advanced tools
Comparing version 0.60.1 to 0.61.0
@@ -306,2 +306,3 @@ 'use strict'; | ||
const getCookieValue = (key) => { | ||
var _a; | ||
try { | ||
@@ -311,15 +312,4 @@ if (!document || !document.cookie) { | ||
} | ||
const name = `${key}=`; | ||
const decodedCookie = decodeURIComponent(document.cookie); | ||
const ca = decodedCookie.split(';'); | ||
for (let i = 0; i < ca.length; i++) { | ||
let c = ca[i]; | ||
while (c.charAt(0) === ' ') { | ||
c = c.substring(1); | ||
} | ||
if (c.indexOf(name) === 0) { | ||
return c.substring(name.length, c.length); | ||
} | ||
} | ||
return ''; | ||
const cookies = parseCookies(document.cookie); | ||
return (_a = cookies[key]) !== null && _a !== void 0 ? _a : ''; | ||
} | ||
@@ -330,2 +320,23 @@ catch { | ||
}; | ||
const parseCookies = (cookie) => { | ||
return Object.fromEntries(cookie | ||
.split(/;\s+/) | ||
.map((r) => r.split('=').map((str) => str.trim())) | ||
.map(([cookieKey, cookieValue]) => { | ||
if (!cookieKey) { | ||
return []; | ||
} | ||
let decodedValue = ''; | ||
if (cookieValue) { | ||
try { | ||
decodedValue = decodeURIComponent(cookieValue); | ||
} | ||
catch (e) { | ||
console.log(`Unable to decode cookie ${cookieKey}: ${e}`); | ||
decodedValue = cookieValue; | ||
} | ||
} | ||
return [cookieKey, decodedValue]; | ||
})); | ||
}; | ||
@@ -348,3 +359,3 @@ const tag = ({ data, eventName, manifestVariables, eventId }) => { | ||
loaded: isLoaded, | ||
sdkVersion: "0.60.1" , | ||
sdkVersion: "0.61.0" , | ||
}; | ||
@@ -351,0 +362,0 @@ }; |
39
index.js
@@ -307,2 +307,3 @@ var ProvidersGoogleAnalytics4Sdk = (function () { | ||
const getCookieValue = (key) => { | ||
var _a; | ||
try { | ||
@@ -312,15 +313,4 @@ if (!document || !document.cookie) { | ||
} | ||
const name = `${key}=`; | ||
const decodedCookie = decodeURIComponent(document.cookie); | ||
const ca = decodedCookie.split(';'); | ||
for (let i = 0; i < ca.length; i++) { | ||
let c = ca[i]; | ||
while (c.charAt(0) === ' ') { | ||
c = c.substring(1); | ||
} | ||
if (c.indexOf(name) === 0) { | ||
return c.substring(name.length, c.length); | ||
} | ||
} | ||
return ''; | ||
const cookies = parseCookies(document.cookie); | ||
return (_a = cookies[key]) !== null && _a !== void 0 ? _a : ''; | ||
} | ||
@@ -331,2 +321,23 @@ catch { | ||
}; | ||
const parseCookies = (cookie) => { | ||
return Object.fromEntries(cookie | ||
.split(/;\s+/) | ||
.map((r) => r.split('=').map((str) => str.trim())) | ||
.map(([cookieKey, cookieValue]) => { | ||
if (!cookieKey) { | ||
return []; | ||
} | ||
let decodedValue = ''; | ||
if (cookieValue) { | ||
try { | ||
decodedValue = decodeURIComponent(cookieValue); | ||
} | ||
catch (e) { | ||
console.log(`Unable to decode cookie ${cookieKey}: ${e}`); | ||
decodedValue = cookieValue; | ||
} | ||
} | ||
return [cookieKey, decodedValue]; | ||
})); | ||
}; | ||
@@ -349,3 +360,3 @@ const tag = ({ data, eventName, manifestVariables, eventId }) => { | ||
loaded: isLoaded, | ||
sdkVersion: "0.60.1" , | ||
sdkVersion: "0.61.0" , | ||
}; | ||
@@ -352,0 +363,0 @@ }; |
{ | ||
"name": "@blotoutio/providers-google-analytics-4-sdk", | ||
"version": "0.60.1", | ||
"version": "0.61.0", | ||
"description": "Google Analytics 4 Browser SDK for EdgeTag", | ||
@@ -5,0 +5,0 @@ "author": "Blotout", |
Sorry, the diff of this file is not supported yet
39967
1144