diff --git a/.env.sample b/.env.sample index b88791dc..25c2fd1a 100644 --- a/.env.sample +++ b/.env.sample @@ -11,3 +11,4 @@ SLACK_KEY=71315967491.XXXXXXXXXX SLACK_SECRET=d2dc414f9953226bad0a356c794XXXXX URL=http://localhost:3000 DEPLOYMENT=hosted +GOOGLE_ANALYTICS_ID= diff --git a/app/components/Layout/Layout.js b/app/components/Layout/Layout.js index a3d576ff..3f1cda5d 100644 --- a/app/components/Layout/Layout.js +++ b/app/components/Layout/Layout.js @@ -6,6 +6,7 @@ import { Helmet } from 'react-helmet'; import styled from 'styled-components'; import { observer, inject } from 'mobx-react'; import keydown from 'react-keydown'; +import Analytics from 'shared/components/Analytics'; import Flex from 'shared/components/Flex'; import { color, layout } from 'shared/styles/constants'; import { documentEditUrl, homeUrl, searchUrl } from 'utils/routeHelpers'; @@ -108,6 +109,7 @@ type Props = { content="width=device-width, initial-scale=1.0" /> + {this.props.ui.progressBarVisible && } {this.props.notifications} diff --git a/server/pages/components/Layout.js b/server/pages/components/Layout.js index 9f7e23e9..023f9332 100644 --- a/server/pages/components/Layout.js +++ b/server/pages/components/Layout.js @@ -2,6 +2,7 @@ import React from 'react'; import { Helmet } from 'react-helmet'; import Navigation from './Navigation'; +import Analytics from '../../../shared/components/Analytics'; import globalStyles from '../../../shared/styles/globals'; type Props = { @@ -18,6 +19,7 @@ export default function Layout({ children }: Props) { Outline + {'{{HEAD}}'} {'{{CSS}}'} diff --git a/shared/components/Analytics.js b/shared/components/Analytics.js new file mode 100644 index 00000000..0e37197c --- /dev/null +++ b/shared/components/Analytics.js @@ -0,0 +1,25 @@ +// @flow +import React from 'react'; + +function Analytics() { + const id = process.env.GOOGLE_ANALYTICS_ID; + if (!id) return null; + + return ( + +