Skip to content

Commit

Permalink
feat: disable analytics if ga_debug_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
alarv committed Oct 21, 2024
1 parent 29282d2 commit db3f8d4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/app/components/GoogleAnalytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ const GoogleAnalytics = () => {

<Script id="" strategy="lazyOnload">
{`
if (window.localStorage.getItem('ga_debug_mode') !== 'true') {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID}', {
page_path: window.location.pathname,
});
}
`}
</Script>
</>
Expand Down

0 comments on commit db3f8d4

Please sign in to comment.