Skip to content

Commit

Permalink
Merge pull request #30 from stape-io/added-common-cookie-support
Browse files Browse the repository at this point in the history
Added common cookie support
  • Loading branch information
Bukashk0zzz authored Jul 12, 2024
2 parents 857f5de + 77bc503 commit 90df51c
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: 3639d997b1a2d25404a82ddaa428e6af05aba1c0
changeNotes: Added common cookie support.
- sha: b0cb2a6c643dd0b5baea1db3d382a1f7bb3bb546
changeNotes: Added missing userData fields.
- sha: 1b2f1fc426f1a7265d462007563cf0861d6600e8
Expand Down
6 changes: 4 additions & 2 deletions template.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ if (url && url.lastIndexOf('https://gtm-msr.appspot.com/', 0) === 0) {
return data.gtmOnSuccess();
}

let ttclid = getCookieValues('ttclid')[0];
const commonCookie = eventData.common_cookie || {};

let ttclid = getCookieValues('ttclid')[0] || commonCookie.ttclid;
if (!ttclid) ttclid = eventData.ttclid;

let ttp = getCookieValues('_ttp')[0];
let ttp = getCookieValues('_ttp')[0] || commonCookie._ttp;
if (!ttp) ttp = eventData._ttp;
if (!ttp && data.generateTtp) {
ttp = generateTtp();
Expand Down
6 changes: 4 additions & 2 deletions template.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -646,10 +646,12 @@ if (url && url.lastIndexOf('https://gtm-msr.appspot.com/', 0) === 0) {
return data.gtmOnSuccess();
}

let ttclid = getCookieValues('ttclid')[0];
const commonCookie = eventData.common_cookie || {};

let ttclid = getCookieValues('ttclid')[0] || commonCookie.ttclid;
if (!ttclid) ttclid = eventData.ttclid;

let ttp = getCookieValues('_ttp')[0];
let ttp = getCookieValues('_ttp')[0] || commonCookie._ttp;
if (!ttp) ttp = eventData._ttp;
if (!ttp && data.generateTtp) {
ttp = generateTtp();
Expand Down

0 comments on commit 90df51c

Please sign in to comment.