Skip to content

Commit

Permalink
Merge pull request #44 from stape-io/fix-consent-state
Browse files Browse the repository at this point in the history
Fix consent state
  • Loading branch information
Bukashk0zzz authored Mar 29, 2024
2 parents bb90634 + 150d557 commit e9291fb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 19 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: 90497724ccbb843c8f0547dc31c54957d41bbe2b
changeNotes: Fix consent settings.
- sha: b44ac56b2e4066c4a8c47922b63a88e82d73fe9b
changeNotes: Add support for multiple Pixel IDs and API Access Tokens
- sha: eddabe8e81fef2235bcdd9c5d38e2a2a714ec681
Expand Down
4 changes: 2 additions & 2 deletions template.js
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,8 @@ function normalizePhoneNumber(phoneNumber) {
function isConsentGivenOrNotRequired() {
if (data.adStorageConsent !== 'required') return true;
if (eventData.consent_state) return !!eventData.consent_state.ad_storage;
const xGaGcs = getRequestHeader('x-ga-gcs') || ''; // x-ga-gcs is a string like "G110"
return xGaGcs[3] === '1';
const xGaGcs = eventData['x-ga-gcs'] || ''; // x-ga-gcs is a string like "G110"
return xGaGcs[2] === '1';
}

function determinateIsLoggingEnabled() {
Expand Down
19 changes: 2 additions & 17 deletions template.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -1361,8 +1361,8 @@ function normalizePhoneNumber(phoneNumber) {
function isConsentGivenOrNotRequired() {
if (data.adStorageConsent !== 'required') return true;
if (eventData.consent_state) return !!eventData.consent_state.ad_storage;
const xGaGcs = getRequestHeader('x-ga-gcs') || ''; // x-ga-gcs is a string like "G110"
return xGaGcs[3] === '1';
const xGaGcs = eventData['x-ga-gcs'] || ''; // x-ga-gcs is a string like "G110"
return xGaGcs[2] === '1';
}

function determinateIsLoggingEnabled() {
Expand Down Expand Up @@ -1721,21 +1721,6 @@ ___SERVER_PERMISSIONS___
"string": "referer"
}
]
},
{
"type": 3,
"mapKey": [
{
"type": 1,
"string": "headerName"
}
],
"mapValue": [
{
"type": 1,
"string": "x-ga-gcs"
}
]
}
]
}
Expand Down

0 comments on commit e9291fb

Please sign in to comment.