Skip to content

Commit

Permalink
Merge branch 'fer/1924' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandolucchesi committed Jan 2, 2024
2 parents 0fbe6cc + a0c3f94 commit 5fe7e77
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
14 changes: 14 additions & 0 deletions web/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,27 @@ function MyApp({ Component, pageProps }: CustomAppProps): JSX.Element {

useConsentState('statistics', enableStatisticsCookies, disableStatisticsCookies)

const GoogleTagManagerHead = () => (
// eslint-disable-next-line @next/next/next-script-for-ga
<script
dangerouslySetInnerHTML={{
__html: `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','${GTM_ID}');`,
}}
/>
)

return (
<SWRConfig>
<ErrorBoundary FallbackComponent={ErrorFallback} onError={HandleBoundaryError}>
<StyledSkipLink>Skip to Content</StyledSkipLink>
<>
<Head>
<meta key="viewport" name="viewport" content="width=device-width, initial-scale=1" />
{GTM_ID && <GoogleTagManagerHead />}
</Head>
<GlobalStyle />
{IS_LIVE && <CookieBot locale={router.locale} />}
Expand Down
7 changes: 1 addition & 6 deletions web/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,7 @@ export default class MyDocument extends Document {
<link rel="stylesheet" href="https://cdn.eds.equinor.com/font/equinor-uprights-vf.css" />
<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16" />
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32" />
{GTM_ID && (
<>
<GoogleConsentMode />
<GoogleTagManagerHead />
</>
)}
{GTM_ID && <GoogleConsentMode />}
</Head>
<body>
{GTM_ID && <GoogleTagManagerBody />}
Expand Down

0 comments on commit 5fe7e77

Please sign in to comment.