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

4
src/analytics/segment.js

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

2
src/components/layout/Default.js

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

Loading…
Cancel
Save