Skip to content

Commit 221889c

Browse files
committed
Removed app cache. Added google analytics.
1 parent dbea576 commit 221889c

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

docs/app.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,11 @@ exports.loadContext = function(callback) {
99
}
1010
return callback(context);
1111
};
12+
13+
exports.onRouteChange = function(state) {
14+
if (typeof window !== "undefined" && window.ga) {
15+
window.ga('send', 'pageview', {
16+
page: state.pathname
17+
});
18+
}
19+
}

docs/config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
siteTitle = "Graphene"
2+
ga = "UA-12613282-7"
23

34
[docs.quickstart]
45
name = "Quickstart"

docs/html.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default class Html extends React.Component {
55
render() {
66
var title = this.props.title || DocumentTitle.rewind();
77
return (
8-
<html lang={this.props.lang} manifest="/graphene.appcache">
8+
<html lang={this.props.lang}>
99
<head>
1010
<meta charSet="utf-8"/>
1111
<meta httpEquiv="X-UA-Compatible" content="IE=edge"/>
@@ -18,6 +18,16 @@ export default class Html extends React.Component {
1818
<body>
1919
<div id="react-mount" dangerouslySetInnerHTML={{__html: this.props.body}} />
2020
<script src="/bundle.js"/>
21+
{this.props.config.ga?<script dangerouslySetInnerHTML={{__html: `
22+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
23+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
24+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
25+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
26+
27+
ga('create', '${this.props.config.ga}', 'auto');
28+
ga('send', 'pageview');
29+
`}}
30+
/>:null}
2131
</body>
2232
</html>
2333
);

docs/static/graphene.appcache

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)