From 7971227445e644b536f94208f43881fcd07bcb05 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Mon, 7 Jan 2019 22:25:05 +0100 Subject: Add analytics events for app delay --- src/features/delayApp/Component.js | 14 ++++++++++++-- src/features/delayApp/index.js | 2 ++ src/lib/analytics.js | 3 +-- 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'; import { defineMessages, intlShape } from 'react-intl'; import injectSheet from 'react-jss'; +import { gaEvent } from '../../lib/analytics'; + import Button from '../../components/ui/Button'; import { config } from '.'; @@ -59,8 +61,16 @@ export default @inject('actions') @injectSheet(styles) @observer class DelayApp clearInterval(this.countdownInterval); } + handleCTAClick() { + const { actions } = this.props; + + actions.ui.openSettings({ path: 'user' }); + + gaEvent('DelayApp', 'subscribe_click', 'Delay App Feature'); + } + render() { - const { classes, actions } = this.props; + const { classes } = this.props; const { intl } = this.context; return ( @@ -70,7 +80,7 @@ export default @inject('actions') @injectSheet(styles) @observer class DelayApp label={intl.formatMessage(messages.action)} className={classes.button} buttonType="inverted" - onClick={() => actions.ui.openSettings({ path: 'user' })} + onClick={this.handleCTAClick.bind(this)} />

{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'; import DelayAppComponent from './Component'; import { DEFAULT_FEATURES_CONFIG } from '../../config'; +import { gaEvent } from '../../lib/analytics'; const debug = require('debug')('Franz:feature:delayApp'); @@ -50,6 +51,7 @@ export default function init(stores) { debug(`App will be delayed for ${config.delayDuration / 1000}s`); setVisibility(true); + gaEvent('delayApp', 'show', 'Delay App Feature'); timeLastDelay = moment(); 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 @@ import { remote } from 'electron'; import { GA_ID } from '../config'; -// import { isDevMode } from '../environment'; const debug = require('debug')('Franz:Analytics'); @@ -36,7 +35,7 @@ export function gaPage(page) { export function gaEvent(category, action, label) { ga('send', 'event', category, action, label); - debug('GA track page', category, action); + debug('GA track event', category, action); } setTimeout(() => { -- cgit v1.2.3-54-g00ecf