Skip to content

Commit 77ef6be

Browse files
authored
Switch to Plausible analytics (#750)
1 parent bbae91b commit 77ef6be

File tree

8 files changed

+5
-61
lines changed

8 files changed

+5
-61
lines changed

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
"react-click-outside": "^3.0.1",
3333
"react-datepicker": "^4.1.1",
3434
"react-dom": "^16.8.3",
35-
"react-ga4": "^2.1.0",
3635
"react-notification-system": "^0.2.17",
3736
"react-redux": "^5.0.5",
3837
"react-router": "^4.1.1",

public/index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747

4848
<body>
4949
<div id="root"></div>
50-
<!-- Cloudflare Web Analytics -->
51-
<script defer src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon='{"token": "99cb727394cb44ea892fbec7a0244274"}'></script>
52-
<!-- End Cloudflare Web Analytics -->
50+
<!-- Plausible Web Analytics -->
51+
<script defer data-domain="osmcha.org" src="https://plausible.io/js/script.js"></script>
52+
<!-- End Plausible Web Analytics -->
5353
</body>
5454

5555
</html>

src/app.js

-9
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { Map } from 'immutable';
55
import { isMobile } from './utils';
66
import { AppMobile } from './AppMobile';
77
import { AppDesktop } from './AppDesktop';
8-
9-
import { gaPageView } from './utils/analytics';
108
import { getSearchObj } from './utils/query_params';
119

1210
export class App extends Component {
@@ -22,13 +20,6 @@ export class App extends Component {
2220
.keySeq()
2321
.sort((a, b) => a.localeCompare(b))
2422
.join(',');
25-
gaPageView({
26-
page: `/?filters=${filters}`,
27-
title: 'Filters',
28-
hitType: 'pageview'
29-
});
30-
} else {
31-
gaPageView({ page: '/', title: 'Home', hitType: 'pageview' });
3223
}
3324
}
3425
}

src/index.js

+1-13
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ import React from 'react';
33
import ReactDOM from 'react-dom';
44
import { ConnectedRouter } from 'react-router-redux';
55
import { Provider } from 'react-redux';
6-
import ReactGA from 'react-ga4';
76
import Raven from 'raven-js';
87
import { history } from './store/history';
98
import { store } from './store';
10-
import { isDev, stack, appVersion } from './config';
9+
import { isDev, appVersion } from './config';
1110
import { unregisterServiceWorker } from './serviceworker';
1211

1312
import './assets/index.css';
@@ -17,17 +16,6 @@ import 'react-select/dist/react-select.css';
1716

1817
import { App } from './app';
1918

20-
ReactGA.initialize([
21-
{
22-
trackingId: 'G-05Y4GLDM03',
23-
gaOptions: {
24-
anonymizeIp: true,
25-
screenResolution: `${window.screen.availWidth}X${window.screen.availHeight}`,
26-
appName: stack
27-
}
28-
}
29-
]);
30-
3119
if (process.env.NODE_ENV === 'production') {
3220
Raven.config('https://[email protected]/175926', {
3321
release: appVersion,

src/utils/analytics.js

-15
This file was deleted.

src/utils/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export * from './analytics';
21
export * from './cmap';
32
export * from './component';
43
export * from './dispatch_event';

src/views/filters.js

+1-14
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { FiltersHeader } from '../components/filters/filters_header';
1515

1616
import { deleteAOI } from '../network/aoi';
1717
import type { RootStateType } from '../store';
18-
import { delayPromise, gaSendEvent, isMobile } from '../utils';
18+
import { delayPromise, isMobile } from '../utils';
1919

2020
import type { filterType, filtersType } from '../components/filters';
2121
const NEW_AOI = 'unnamed *';
@@ -80,26 +80,13 @@ class Filters extends React.PureComponent<void, propsType, stateType> {
8080
return;
8181
}
8282
this.props.applyFilters(this.state.filters, '/');
83-
this.sendToAnalytics();
8483
// show user if there were any new changesets
8584
// incase service had cached the request
8685
delayPromise(3000).promise.then(() =>
8786
this.props.checkForNewChangesets(true)
8887
);
8988
}
9089
};
91-
sendToAnalytics = () => {
92-
const filters = this.state.filters;
93-
filters.forEach((v, k) => {
94-
v.forEach(vv => {
95-
gaSendEvent({
96-
category: 'Filters',
97-
action: k,
98-
label: vv.get('label')
99-
});
100-
});
101-
});
102-
};
10390
handleChange = (name: string, values?: filterType) => {
10491
let filters = this.state.filters;
10592
// if someone cleared date__gte filter

yarn.lock

-5
Original file line numberDiff line numberDiff line change
@@ -10619,11 +10619,6 @@ react-fast-compare@^3.0.1:
1061910619
resolved "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.0.tgz"
1062010620
integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA==
1062110621

10622-
react-ga4@^2.1.0:
10623-
version "2.1.0"
10624-
resolved "https://registry.npmjs.org/react-ga4/-/react-ga4-2.1.0.tgz"
10625-
integrity sha512-ZKS7PGNFqqMd3PJ6+C2Jtz/o1iU9ggiy8Y8nUeksgVuvNISbmrQtJiZNvC/TjDsqD0QlU5Wkgs7i+w9+OjHhhQ==
10626-
1062710622
react-input-autosize@^2.1.2:
1062810623
version "2.2.1"
1062910624
resolved "https://registry.npmjs.org/react-input-autosize/-/react-input-autosize-2.2.1.tgz"

0 commit comments

Comments
 (0)