Skip to content

Commit

Permalink
feat: Update GTM
Browse files Browse the repository at this point in the history
  • Loading branch information
oodamien committed May 6, 2024
1 parent 9040aa3 commit 123c96a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gatsby-ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ function setGTM(w, d, s, l, i) {
f.parentNode.insertBefore(j, f);
}
if (document.cookie.indexOf('OptanonConsent') > -1 && document.cookie.indexOf('groups=') > -1) {
setGTM(window, document, 'script', 'dataLayer', 'GTM-KZM7GF6');
setGTM(window, document, 'script', 'dataLayer', 'GTM-W8CQ8TL');
} else {
waitForOnetrustActiveGroups();
}
var timer;
function waitForOnetrustActiveGroups() {
if (document.cookie.indexOf('OptanonConsent') > -1 && document.cookie.indexOf('groups=') > -1) {
clearTimeout(timer);
setGTM(window, document, 'script', 'dataLayer', 'GTM-KZM7GF6');
setGTM(window, document, 'script', 'dataLayer', 'GTM-W8CQ8TL');
} else {
timer = setTimeout(waitForOnetrustActiveGroups, 250);
}
Expand Down

0 comments on commit 123c96a

Please sign in to comment.