Browse Source

App Starts is a mandatory track

master
Gaëtan Renaudeau 7 years ago
parent
commit
483457fba0
  1. 5
      src/analytics/Track.js
  2. 4
      src/analytics/segment.js
  3. 2
      src/components/layout/Default.js

5
src/analytics/Track.js

@ -7,6 +7,7 @@ class Track extends PureComponent<{
onUnmount?: boolean, onUnmount?: boolean,
onUpdate?: boolean, onUpdate?: boolean,
event: string, event: string,
mandatory?: boolean,
}> { }> {
componentDidMount() { componentDidMount() {
if (typeof this.props.event !== 'string') { if (typeof this.props.event !== 'string') {
@ -21,8 +22,8 @@ class Track extends PureComponent<{
if (this.props.onUnmount) this.track() if (this.props.onUnmount) this.track()
} }
track = () => { track = () => {
const { event, onMount, onUnmount, onUpdate, ...properties } = this.props const { event, onMount, onUnmount, onUpdate, mandatory, ...properties } = this.props
track(event, properties) track(event, properties, mandatory)
} }
render() { render() {
return null return null

4
src/analytics/segment.js

@ -72,9 +72,9 @@ export const stop = () => {
analytics.reset() analytics.reset()
} }
export const track = (event: string, properties: ?Object) => { export const track = (event: string, properties: ?Object, mandatory: ?boolean) => {
logger.analyticsTrack(event, properties) logger.analyticsTrack(event, properties)
if (!storeInstance || !shareAnalyticsSelector(storeInstance.getState())) { if (!storeInstance || (!mandatory && !shareAnalyticsSelector(storeInstance.getState()))) {
return return
} }
const { analytics } = window const { analytics } = window

2
src/components/layout/Default.js

@ -85,7 +85,7 @@ class Default extends Component<Props> {
<TriggerAppReady /> <TriggerAppReady />
{process.platform === 'darwin' && <AppRegionDrag />} {process.platform === 'darwin' && <AppRegionDrag />}
<ExportLogsBtn hookToShortcut /> <ExportLogsBtn hookToShortcut />
<Track onMount event="App Starts" /> <Track mandatory onMount event="App Starts" />
<OnboardingOrElse> <OnboardingOrElse>
<IsUnlocked> <IsUnlocked>

Loading…
Cancel
Save