Skip to content

Commit

Permalink
Bugfix: Google Analytics 4 cookie was not deleted correctly due to mi…
Browse files Browse the repository at this point in the history
…ssing opt-out (#127)
  • Loading branch information
doishub committed Sep 14, 2022
1 parent 36259b3 commit 1b72a7a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Resources/contao/classes/CookieHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ private function compileGoogleAnalytics()
self::LOAD_CONFIRMED,
self::POS_HEAD
);

$this->addScript(
"try{ let gid; for(gid in window.google_tag_data.td) { window['ga-disable-' + gid] = true; }}catch (e) {}",
self::LOAD_UNCONFIRMED,
self::POS_HEAD
);
}

/**
Expand Down

0 comments on commit 1b72a7a

Please sign in to comment.