aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/analytics.js
diff options
context:
space:
mode:
authorLibravatar vantezzen <properly@protonmail.com>2019-08-21 09:39:39 +0200
committerLibravatar vantezzen <properly@protonmail.com>2019-08-21 09:39:39 +0200
commitc4768a221f93d534f4d0454414cdf073af8a2356 (patch)
tree77fdf9eb3cbfa72c8fe40e45c88af61299004609 /src/lib/analytics.js
parentUpdate dev-app-update.yml (diff)
downloadferdium-app-c4768a221f93d534f4d0454414cdf073af8a2356.tar.gz
ferdium-app-c4768a221f93d534f4d0454414cdf073af8a2356.tar.zst
ferdium-app-c4768a221f93d534f4d0454414cdf073af8a2356.zip
Remove analytics
Diffstat (limited to 'src/lib/analytics.js')
-rw-r--r--src/lib/analytics.js55
1 files changed, 0 insertions, 55 deletions
diff --git a/src/lib/analytics.js b/src/lib/analytics.js
deleted file mode 100644
index c305fdb00..000000000
--- a/src/lib/analytics.js
+++ /dev/null
@@ -1,55 +0,0 @@
1import { remote } from 'electron';
2import querystring from 'querystring';
3
4import { GA_ID, STATS_API } from '../config';
5import { isDevMode } from '../environment';
6
7const debug = require('debug')('Franz:Analytics');
8
9const { app } = remote;
10
11/* eslint-disable */
12(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
13(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
14m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
15})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
16/* eslint-enable */
17
18const GA_LOCAL_STORAGE_KEY = 'gaUid';
19
20ga('create', GA_ID, {
21 storage: 'none',
22 clientId: localStorage.getItem(GA_LOCAL_STORAGE_KEY),
23});
24
25ga((tracker) => {
26 localStorage.setItem(GA_LOCAL_STORAGE_KEY, tracker.get('clientId'));
27});
28ga('set', 'checkProtocolTask', null);
29ga('set', 'version', app.getVersion());
30ga('send', 'App');
31
32export function gaPage(page) {
33 ga('send', 'pageview', page);
34 debug('GA track page', page);
35}
36
37export function gaEvent(category, action, label) {
38 ga('send', 'event', category, action, label);
39 debug('GA track event', category, action, label);
40}
41
42export function statsEvent(key, value) {
43 const params = {
44 key,
45 value: value || key,
46 platform: process.platform,
47 version: remote.app.getVersion(),
48 };
49
50 debug('Send Franz stats event', params);
51
52 if (!isDevMode) {
53 window.fetch(`${STATS_API}/event/?${querystring.stringify(params)}`);
54 }
55}