mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-03 08:49:51 +02:00
better?
This commit is contained in:
parent
f1b5b66813
commit
543b5df52b
1 changed files with 7 additions and 0 deletions
|
@ -12,6 +12,12 @@ import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
|
|||
import globalData from '@generated/globalData';
|
||||
import type {PluginOptions} from '@docusaurus/plugin-google-gtag';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
'ga-disable-MEASUREMENT_ID': boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export default (function () {
|
||||
if (!ExecutionEnvironment.canUseDOM) {
|
||||
return null;
|
||||
|
@ -40,6 +46,7 @@ export default (function () {
|
|||
localStorage.getItem('docusaurus.cookieConsent') ?? 'null',
|
||||
) as boolean | null;
|
||||
if (!cookieConsentResponse) {
|
||||
window['ga-disable-MEASUREMENT_ID'] = true;
|
||||
return;
|
||||
}
|
||||
// Always refer to the variable on window in-case it gets overridden elsewhere.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue