File tree 3 files changed +29
-1
lines changed
3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 1
1
import 'normalize.css' ;
2
2
import './src/global.css' ;
3
+
4
+ export const onRouteUpdate = ( ) => {
5
+ // For Google Analytics page views
6
+ if ( window . ga ) {
7
+ window . ga ( 'send' , 'pageview' ) ;
8
+ }
9
+ } ;
Original file line number Diff line number Diff line change @@ -67,11 +67,12 @@ export default function Home(props) {
67
67
</ SearchContainer >
68
68
69
69
< WhiteContainer >
70
- { categories . map ( ( category ) => (
70
+ { categories . map ( ( category , index ) => (
71
71
< CategoryCard
72
72
title = { category . name }
73
73
url = { `/${ category . slug } /` }
74
74
description = { category . description . description }
75
+ key = { index }
75
76
/>
76
77
) ) }
77
78
</ WhiteContainer >
Original file line number Diff line number Diff line change 1
1
import * as React from 'react' ;
2
2
import styled from '@emotion/styled' ;
3
+ import { Helmet } from 'react-helmet' ;
3
4
import Header from '../components/header' ;
4
5
import Footer from '../components/footer' ;
5
6
import Wrap from '../components/wrap' ;
@@ -53,6 +54,25 @@ export default function Layout(props) {
53
54
logoUrl = { settings . logo . fixed . src }
54
55
logoDescription = { settings . logo . title }
55
56
/>
57
+
58
+ < Helmet >
59
+ { settings . googleAnalyticsId && (
60
+ < script >
61
+ { `
62
+ window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
63
+
64
+ ga('create', '${ settings . googleAnalyticsId } ', 'auto');
65
+ ga('send', 'pageview');
66
+ ` }
67
+ </ script >
68
+ ) }
69
+ { settings . googleAnalyticsId && (
70
+ < script
71
+ async
72
+ src = "https://www.google-analytics.com/analytics.js"
73
+ > </ script >
74
+ ) }
75
+ </ Helmet >
56
76
</ >
57
77
) ;
58
78
}
You can’t perform that action at this time.
0 commit comments