Skip to content

Commit c265a7b

Browse files
switching to gatsby GA plugin
1 parent c2947c2 commit c265a7b

File tree

10 files changed

+12
-1502
lines changed

10 files changed

+12
-1502
lines changed

gatsby-config.js

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ module.exports = {
1212
postCssPlugins: [autoprefixer()],
1313
},
1414
},
15+
{
16+
resolve: 'gatsby-plugin-google-analytics',
17+
options: {
18+
trackingId: 'UA-35433268-86',
19+
},
20+
},
1521
],
1622
pathPrefix: '/playground',
1723
};

package-lock.json

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"eslint-plugin-react": "^7.1.0",
1717
"gatsby": "^1.9.36",
1818
"gatsby-link": "^1.6.15",
19+
"gatsby-plugin-google-analytics": "^1.0.7",
1920
"gatsby-plugin-postcss-sass": "^1.0.12",
2021
"gatsby-plugin-react-helmet": "^1.0.6",
2122
"gh-pages": "^1.0.0",

src/layouts/index.js

-10
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,11 @@ import Header from '../components/layout/Header';
1515
import Footer from '../components/layout/Footer';
1616
import Hero from '../components/layout/Hero';
1717

18-
// google analytics
19-
// checking for window and checking for window to ignore errors during build
20-
if (typeof window !== 'undefined') {
21-
require('../utils/ga/ga'); // eslint-disable-line
22-
}
23-
2418
const Layout = ({ children }) => (
2519
<div className="wrapper">
2620
<Helmet>
2721
<link rel="shortcut icon" type="image/x-icon" href={faviconico} />
2822
<link rel="icon" type="image/png" href={faviconpng} sizes="196x196" />
29-
<script async src={`${__PATH_PREFIX__}/js/dnt.js`} />
30-
<script async src={`${__PATH_PREFIX__}/js/ga.js`} />
31-
<script async src={`${__PATH_PREFIX__}/js/autotrack.js`} />
32-
<script async src="https://www.google-analytics.com/analytics.js" />
3323

3424
<meta
3525
name="description"

0 commit comments

Comments
 (0)