Skip to content

Commit

Permalink
Switch to Plausible analytics (#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
willemarcel authored Oct 23, 2024
1 parent bbae91b commit 77ef6be
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 61 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"react-click-outside": "^3.0.1",
"react-datepicker": "^4.1.1",
"react-dom": "^16.8.3",
"react-ga4": "^2.1.0",
"react-notification-system": "^0.2.17",
"react-redux": "^5.0.5",
"react-router": "^4.1.1",
Expand Down
6 changes: 3 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@

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

</html>
9 changes: 0 additions & 9 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { Map } from 'immutable';
import { isMobile } from './utils';
import { AppMobile } from './AppMobile';
import { AppDesktop } from './AppDesktop';

import { gaPageView } from './utils/analytics';
import { getSearchObj } from './utils/query_params';

export class App extends Component {
Expand All @@ -22,13 +20,6 @@ export class App extends Component {
.keySeq()
.sort((a, b) => a.localeCompare(b))
.join(',');
gaPageView({
page: `/?filters=${filters}`,
title: 'Filters',
hitType: 'pageview'
});
} else {
gaPageView({ page: '/', title: 'Home', hitType: 'pageview' });
}
}
}
Expand Down
14 changes: 1 addition & 13 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import React from 'react';
import ReactDOM from 'react-dom';
import { ConnectedRouter } from 'react-router-redux';
import { Provider } from 'react-redux';
import ReactGA from 'react-ga4';
import Raven from 'raven-js';
import { history } from './store/history';
import { store } from './store';
import { isDev, stack, appVersion } from './config';
import { isDev, appVersion } from './config';
import { unregisterServiceWorker } from './serviceworker';

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

import { App } from './app';

ReactGA.initialize([
{
trackingId: 'G-05Y4GLDM03',
gaOptions: {
anonymizeIp: true,
screenResolution: `${window.screen.availWidth}X${window.screen.availHeight}`,
appName: stack
}
}
]);

if (process.env.NODE_ENV === 'production') {
Raven.config('https://5637ef87f5794e2fb9e1e5fe9119688d@sentry.io/175926', {
release: appVersion,
Expand Down
15 changes: 0 additions & 15 deletions src/utils/analytics.js

This file was deleted.

1 change: 0 additions & 1 deletion src/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './analytics';
export * from './cmap';
export * from './component';
export * from './dispatch_event';
Expand Down
15 changes: 1 addition & 14 deletions src/views/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { FiltersHeader } from '../components/filters/filters_header';

import { deleteAOI } from '../network/aoi';
import type { RootStateType } from '../store';
import { delayPromise, gaSendEvent, isMobile } from '../utils';
import { delayPromise, isMobile } from '../utils';

import type { filterType, filtersType } from '../components/filters';
const NEW_AOI = 'unnamed *';
Expand Down Expand Up @@ -80,26 +80,13 @@ class Filters extends React.PureComponent<void, propsType, stateType> {
return;
}
this.props.applyFilters(this.state.filters, '/');
this.sendToAnalytics();
// show user if there were any new changesets
// incase service had cached the request
delayPromise(3000).promise.then(() =>
this.props.checkForNewChangesets(true)
);
}
};
sendToAnalytics = () => {
const filters = this.state.filters;
filters.forEach((v, k) => {
v.forEach(vv => {
gaSendEvent({
category: 'Filters',
action: k,
label: vv.get('label')
});
});
});
};
handleChange = (name: string, values?: filterType) => {
let filters = this.state.filters;
// if someone cleared date__gte filter
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10619,11 +10619,6 @@ react-fast-compare@^3.0.1:
resolved "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.0.tgz"
integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA==

react-ga4@^2.1.0:
version "2.1.0"
resolved "https://registry.npmjs.org/react-ga4/-/react-ga4-2.1.0.tgz"
integrity sha512-ZKS7PGNFqqMd3PJ6+C2Jtz/o1iU9ggiy8Y8nUeksgVuvNISbmrQtJiZNvC/TjDsqD0QlU5Wkgs7i+w9+OjHhhQ==

react-input-autosize@^2.1.2:
version "2.2.1"
resolved "https://registry.npmjs.org/react-input-autosize/-/react-input-autosize-2.2.1.tgz"
Expand Down

0 comments on commit 77ef6be

Please sign in to comment.