aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-01-07 22:25:05 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-01-07 22:25:05 +0100
commit7971227445e644b536f94208f43881fcd07bcb05 (patch)
treebf6ca7b811e06f49d9fa1722c32d95e7a886f46f /src
parentReplace jshashes with node crypto module (diff)
downloadferdium-app-7971227445e644b536f94208f43881fcd07bcb05.tar.gz
ferdium-app-7971227445e644b536f94208f43881fcd07bcb05.tar.zst
ferdium-app-7971227445e644b536f94208f43881fcd07bcb05.zip
Add analytics events for app delay
Diffstat (limited to 'src')
-rw-r--r--src/features/delayApp/Component.js14
-rw-r--r--src/features/delayApp/index.js2
-rw-r--r--src/lib/analytics.js3
3 files changed, 15 insertions, 4 deletions
diff --git a/src/features/delayApp/Component.js b/src/features/delayApp/Component.js
index 6e0532c9a..ff84510e8 100644
--- a/src/features/delayApp/Component.js
+++ b/src/features/delayApp/Component.js
@@ -4,6 +4,8 @@ import { inject, observer } from 'mobx-react';
4import { defineMessages, intlShape } from 'react-intl'; 4import { defineMessages, intlShape } from 'react-intl';
5import injectSheet from 'react-jss'; 5import injectSheet from 'react-jss';
6 6
7import { gaEvent } from '../../lib/analytics';
8
7import Button from '../../components/ui/Button'; 9import Button from '../../components/ui/Button';
8 10
9import { config } from '.'; 11import { config } from '.';
@@ -59,8 +61,16 @@ export default @inject('actions') @injectSheet(styles) @observer class DelayApp
59 clearInterval(this.countdownInterval); 61 clearInterval(this.countdownInterval);
60 } 62 }
61 63
64 handleCTAClick() {
65 const { actions } = this.props;
66
67 actions.ui.openSettings({ path: 'user' });
68
69 gaEvent('DelayApp', 'subscribe_click', 'Delay App Feature');
70 }
71
62 render() { 72 render() {
63 const { classes, actions } = this.props; 73 const { classes } = this.props;
64 const { intl } = this.context; 74 const { intl } = this.context;
65 75
66 return ( 76 return (
@@ -70,7 +80,7 @@ export default @inject('actions') @injectSheet(styles) @observer class DelayApp
70 label={intl.formatMessage(messages.action)} 80 label={intl.formatMessage(messages.action)}
71 className={classes.button} 81 className={classes.button}
72 buttonType="inverted" 82 buttonType="inverted"
73 onClick={() => actions.ui.openSettings({ path: 'user' })} 83 onClick={this.handleCTAClick.bind(this)}
74 /> 84 />
75 <p className="footnote"> 85 <p className="footnote">
76 {intl.formatMessage(messages.text, { 86 {intl.formatMessage(messages.text, {
diff --git a/src/features/delayApp/index.js b/src/features/delayApp/index.js
index d5c544b78..3412ad5d1 100644
--- a/src/features/delayApp/index.js
+++ b/src/features/delayApp/index.js
@@ -3,6 +3,7 @@ import moment from 'moment';
3import DelayAppComponent from './Component'; 3import DelayAppComponent from './Component';
4 4
5import { DEFAULT_FEATURES_CONFIG } from '../../config'; 5import { DEFAULT_FEATURES_CONFIG } from '../../config';
6import { gaEvent } from '../../lib/analytics';
6 7
7const debug = require('debug')('Franz:feature:delayApp'); 8const debug = require('debug')('Franz:feature:delayApp');
8 9
@@ -50,6 +51,7 @@ export default function init(stores) {
50 debug(`App will be delayed for ${config.delayDuration / 1000}s`); 51 debug(`App will be delayed for ${config.delayDuration / 1000}s`);
51 52
52 setVisibility(true); 53 setVisibility(true);
54 gaEvent('delayApp', 'show', 'Delay App Feature');
53 55
54 timeLastDelay = moment(); 56 timeLastDelay = moment();
55 shownAfterLaunch = true; 57 shownAfterLaunch = true;
diff --git a/src/lib/analytics.js b/src/lib/analytics.js
index 8b9a44579..7044e5bb7 100644
--- a/src/lib/analytics.js
+++ b/src/lib/analytics.js
@@ -1,6 +1,5 @@
1import { remote } from 'electron'; 1import { remote } from 'electron';
2import { GA_ID } from '../config'; 2import { GA_ID } from '../config';
3// import { isDevMode } from '../environment';
4 3
5const debug = require('debug')('Franz:Analytics'); 4const debug = require('debug')('Franz:Analytics');
6 5
@@ -36,7 +35,7 @@ export function gaPage(page) {
36export function gaEvent(category, action, label) { 35export function gaEvent(category, action, label) {
37 ga('send', 'event', category, action, label); 36 ga('send', 'event', category, action, label);
38 37
39 debug('GA track page', category, action); 38 debug('GA track event', category, action);
40} 39}
41 40
42setTimeout(() => { 41setTimeout(() => {