Skip to content

Commit d1e22f9

Browse files
author
Ives van Hoorne
committed
Update analytics
1 parent ec32b2a commit d1e22f9

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

src/app/index.html

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,17 @@
3232
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
3333

3434
ga('create', 'UA-89432508-1', 'auto');
35-
ga('send', 'pageview');
3635
</script>
3736
<script>
3837
!function (e, t, n, s, u, a) {
39-
e.twq || (s = e.twq = function () {
40-
s.exe ? s.exe.apply(s, arguments) : s.queue.push(arguments);
41-
}, s.version = '1.1', s.queue = [], u = t.createElement(n), u.async = !0, u.src = '//static.ads-twitter.com/uwt.js',
42-
a = t.getElementsByTagName(n)[0], a.parentNode.insertBefore(u, a))
43-
}(window, document, 'script');
38+
e.twq || (s = e.twq = function () {
39+
s.exe ? s.exe.apply(s, arguments) : s.queue.push(arguments);
40+
}, s.version = '1.1', s.queue = [], u = t.createElement(n), u.async = !0, u.src = '//static.ads-twitter.com/uwt.js',
41+
a = t.getElementsByTagName(n)[0], a.parentNode.insertBefore(u, a))
42+
}(window, document, 'script');
4443
// Insert Twitter Pixel ID and Standard Event data below
4544
twq('init', 'nx5o6');
4645
twq('track', 'PageView');
47-
4846
</script>
4947
<script src="https://cdn.ravenjs.com/3.14.0/raven.min.js" crossorigin="anonymous"></script>
5048
</head>

src/app/pages/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ import React from 'react';
33
import styled from 'styled-components';
44
import { Route, Switch, Redirect } from 'react-router-dom';
55

6+
import _debug from 'app/utils/debug';
7+
68
import Notifications from 'app/containers/Notifications';
79
import ContextMenu from 'app/containers/ContextMenu';
810
import Sandbox from './Sandbox/';
911
import SignIn from './SignIn';
1012
import NotFound from './NotFound';
1113

14+
const routeDebugger = _debug('cs:app:router');
15+
1216
const Container = styled.div`
1317
display: flex;
1418
height: 100%;
@@ -24,6 +28,19 @@ const Content = styled.div`
2428

2529
export default () => (
2630
<Container>
31+
<Route
32+
path="/"
33+
render={({ location }) => {
34+
routeDebugger(
35+
`Sending '${location.pathname + location.search}' to ga.`
36+
);
37+
if (typeof window.ga === 'function') {
38+
window.ga('set', 'page', location.pathname + location.search);
39+
window.ga('send', 'pageview');
40+
}
41+
return null;
42+
}}
43+
/>
2744
<Notifications />
2845
<ContextMenu />
2946
<Content>

0 commit comments

Comments
 (0)