Skip to content

Commit

Permalink
Cookie mitigation, see #61
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanolson committed Jan 31, 2023
1 parent 2842cea commit fbf97af
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions js/analytics/google-analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@
function gtag() { ga4DataLayer.push( arguments ); } // eslint-disable-line no-inner-declarations,no-undef,prefer-rest-params

gtag( 'js', new Date() );
gtag( 'consent', 'default', {
ad_storage: 'denied',
analytics_storage: 'denied'
} );
gtag( 'config', phet.chipper.getQueryParameter( 'ga4' ) );

// Dynamically load the script
Expand All @@ -154,6 +158,13 @@
// For some reason, having dataLayer declaration here might have fixed the ability to use gtag.js and gtm.js at the
// same time. Don't move without testing.
window.dataLayer = window.dataLayer || [];
function gtmTag() {
window.dataLayer.push( arguments ); // eslint-disable-line prefer-rest-params
}
gtmTag( 'consent', 'default', {
ad_storage: 'denied',
analytics_storage: 'denied'
} );
window.dataLayer.push( {
simBrand: phet.chipper.brand,
simName: phet.chipper.project,
Expand Down

0 comments on commit fbf97af

Please sign in to comment.