Skip to content

Commit 47af702

Browse files
David Silvadvidsilva
authored andcommitted
not sending GA data if do not track is enabled
1 parent 4fb2691 commit 47af702

File tree

3 files changed

+26
-21
lines changed

3 files changed

+26
-21
lines changed

public/index.html

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,17 @@
2222
<body>
2323
<div id="root"></div>
2424
<script>
25-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
26-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
27-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
28-
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
29-
ga('create', 'UA-76234320-2', 'auto');
30-
ga('send', 'pageview');
25+
var dnt_isIe10or11 = (navigator.appVersion.indexOf("MSIE 10") !== -1) || (navigator.userAgent.indexOf("Trident") !== -1 && navigator.userAgent.indexOf("rv:11") !== -1);
26+
var DNT = (navigator.doNotTrack || navigator.msDoNotTrack || window.doNotTrack);
27+
DNT = !DNT || DNT == "unspecified" || DNT == "0" ? false : true;
28+
if (!DNT || dnt_isIe10or11) {
29+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
30+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
31+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
32+
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
33+
ga('create', 'UA-76234320-2', 'auto');
34+
ga('send', 'pageview');
35+
}
3136
</script>
3237
</body>
3338
</html>

src/containers/about/codeOfConduct.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React, { Component } from 'react';
2+
import ReactMarkdown from 'react-markdown';
3+
import CodeOfConductMD from '../../../CODE_OF_CONDUCT.md';
4+
5+
class codeOfConduct extends Component {
6+
render() {
7+
return(
8+
<div>
9+
<ReactMarkdown source={ CodeOfConductMD } />
10+
</div>
11+
);
12+
}
13+
}
14+
15+
export default codeOfConduct;

src/store.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,6 @@ history.listen(___location => {
1111
window && window.ga && window.ga('send', 'pageview', ___location.pathname);
1212
});
1313

14-
const _gaq = window._gaq || [];
15-
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
16-
_gaq.push(['_trackPageview']);
17-
18-
(() => {
19-
if (document) {
20-
const ga = document.createElement('script');
21-
ga.type = 'text/javascript';
22-
ga.async = true;
23-
ga.src = (document.___location.protocol === 'https:' ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
24-
const s = document.getElementsByTagName('script')[0];
25-
s.parentNode.insertBefore(ga, s);
26-
}
27-
})();
28-
2914
export { history };
3015

3116
const initialState = {};

0 commit comments

Comments
 (0)