Skip to content

Commit

Permalink
Merge pull request #15 from stape-io/override-click-id-and-user-data-…
Browse files Browse the repository at this point in the history
…hashing

Override click id & userData hashing fix
  • Loading branch information
Bukashk0zzz authored Jul 5, 2024
2 parents 6ac3401 + 05a682f commit 36519e1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
homepage: "https://stape.io/"
versions:
- sha: 8671ef925695c8b4a9b7b992b7c7552a0d1b6b8c
changeNotes: Override click id & userData hashing fix.
- sha: 81fefccc9ebf0f95b71475cf07e65b45b7132879
changeNotes: Data validation improvements.
- sha: a811c915bc0c838675f6050483eaf49f8f484c0c
Expand Down
6 changes: 3 additions & 3 deletions template.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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();
}

Expand Down Expand Up @@ -243,7 +243,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;
}
});
Expand Down Expand Up @@ -341,7 +341,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;
Expand Down
6 changes: 5 additions & 1 deletion template.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,10 @@ ___TEMPLATE_PARAMETERS___
{
"value": "client_user_agent",
"displayValue": "User Agent"
},
{
"value": "sc_click_id",
"displayValue": "Click ID"
}
]
},
Expand Down Expand Up @@ -547,7 +551,7 @@ ___TEMPLATE_PARAMETERS___
{
"type": "LABEL",
"name": "сustomDataLabel",
"displayName": "See \u003ca href\u003d\"https://marketingapi.snapchat.com/docs/conversion.html#conversion-parameters\" target\u003d\"_blank\"\u003ethis documentation\u003c/a\u003e for more details on what data parameters you can add to the call."
"displayName": "See \u003ca href\u003d\"https://docs.snap.com/api/marketing-api/Conversions-API/Parameters\" target\u003d\"_blank\"\u003ethis documentation\u003c/a\u003e for more details on what data parameters you can add to the call."
},
{
"name": "customDataList",
Expand Down

0 comments on commit 36519e1

Please sign in to comment.