diff --git a/public/googleTagManager.js b/public/googleTagManager.js new file mode 100644 index 00000000..9e7a5e4f --- /dev/null +++ b/public/googleTagManager.js @@ -0,0 +1,3 @@ +export const gtmScript = "(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-NT29XCN');"; + +export const gtmNoscript = ''; diff --git a/public/index.jsx b/public/index.jsx index eca1d092..b1f2d9e4 100644 --- a/public/index.jsx +++ b/public/index.jsx @@ -1,12 +1,17 @@ import React from 'react'; import ReactDOMServer from 'react-dom/server'; +import { gtmScript } from './googleTagManager'; + export default function renderHtml(data, body) { return ` ${ReactDOMServer.renderToStaticMarkup( + {(process.env.NODE_ENV === 'production') && +