Skip to content

Commit

Permalink
Added common cookie support
Browse files Browse the repository at this point in the history
  • Loading branch information
kHorozhanov committed Jul 12, 2024
1 parent 857f5de commit 3639d99
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
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 3639d99

Please sign in to comment.