Fix - Analytics not working

pull/1657/head
Kamran Ahmed 5 years ago
parent ae9c6b87df
commit 61f9ea884b
  1. 1
      .gitignore
  2. 22
      components/helmet/index.js

1
.gitignore vendored

@ -4,6 +4,7 @@ Thumbs.db
.idea
.next
out
.env
build
node_modules
yarn-error.log

@ -56,19 +56,15 @@ const Helmet = (props) => (
<link rel="icon" href="/static/manifest/favicon.ico" type="image/x-icon" />
{ /* Global Site Tag (gtag.js) - Google Analytics */ }
{ !PHASE_DEVELOPMENT_SERVER && (
<>
<script async src={ `https://www.googletagmanager.com/gtag/js?id=${GA_TRACKING_ID}` } />
<script dangerouslySetInnerHTML={{
__html: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${GA_TRACKING_ID}');
`,
}} />
</>
)}
<script async src={ `https://www.googletagmanager.com/gtag/js?id=${GA_TRACKING_ID}` } />
<script dangerouslySetInnerHTML={{
__html: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${GA_TRACKING_ID}');
`,
}} />
</NextHead>
);

Loading…
Cancel
Save