From 606f02c9e2f6aeddeac547779ae7c13c39a3b24b Mon Sep 17 00:00:00 2001 From: Kostiantyn Horozhanov Date: Fri, 5 Jul 2024 16:34:00 +0200 Subject: [PATCH] Update .tpl with user_data hashing fix --- template.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/template.tpl b/template.tpl index a02c8a1..aa99e80 100644 --- a/template.tpl +++ b/template.tpl @@ -673,7 +673,7 @@ if (url && url.lastIndexOf('https://gtm-msr.appspot.com/', 0) === 0) { } const pixelOrAppId = data.eventConversionType === 'MOBILE_APP' ? data.snapAppId : data.pixelId; -if(!pixelOrAppId || !data.accessToken) { +if (!pixelOrAppId || !data.accessToken) { return data.gtmOnFailure(); } @@ -883,7 +883,7 @@ function addCustomData(eventData, mappedData) { if (data.customDataList) { data.customDataList.forEach((d) => { - if(isValidValue(d.value)) { + if (isValidValue(d.value)) { mappedData.custom_data[d.name] = d.value; } }); @@ -981,7 +981,7 @@ function hashDataIfNeeded(mappedData) { const fieldsToHash = ['em', 'ph', 'fn', 'ln', 'ge', 'ct', 'st', 'zp', 'country', 'external_id']; for (let key in mappedData.user_data) { if (fieldsToHash.indexOf(key) !== -1) { - mappedData[key] = hashData(mappedData[key]); + mappedData.user_data[key] = hashData(mappedData.user_data[key]); } } return mappedData;