How to use the analytics/segment.track function in analytics

To help you get started, we’ve selected a few analytics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LedgerHQ / ledger-live-desktop / src / components / StickyBackToTop.js View on Github external
onClick = () => {
    const { scrollContainer } = this.props.getGrowScroll()
    if (scrollContainer) {
      // $FlowFixMe seems to be missing in flow
      scrollContainer.scrollTo({ top: 0, behavior: 'smooth' })
      track('ScrollBackToTop')
    }
  }
github LedgerHQ / ledger-live-desktop / src / components / modals / Send / Body.js View on Github external
const bridge = getAccountBridge(account, parentAccount)
      if (!device) {
        handleTransactionError(new DisconnectedDevice())
        transitionTo('confirmation')
        return
      }

      invariant(account && transaction && bridge, 'signTransaction invalid conditions')

      const eventProps = {
        currencyName: mainAccount.currency.name,
        derivationMode: mainAccount.derivationMode,
        freshAddressPath: mainAccount.freshAddressPath,
        operationsLength: mainAccount.operations.length,
      }
      track('SendTransactionStart', eventProps)
      signTransactionSubRef.current = bridge
        .signAndBroadcast(mainAccount, transaction, device.path)
        .subscribe({
          next: e => {
            switch (e.type) {
              case 'signed': {
                track('SendTransactionSigned', eventProps)
                setSigned(true)
                transitionTo('confirmation')
                break
              }
              case 'broadcasted': {
                track('SendTransactionBroadcasted', eventProps)
                handleOperationBroadcasted(e.operation)
                break
              }
github LedgerHQ / ledger-live-desktop / src / components / modals / Send / Body.js View on Github external
error: err => {
            if (err.statusCode === 0x6985) {
              track('SendTransactionRefused', eventProps)
              handleTransactionError(new UserRefusedOnDevice())
              transitionTo('refused')
            } else {
              track('SendTransactionError', eventProps)
              handleTransactionError(err)
              transitionTo('confirmation')
            }
          },
        })
github LedgerHQ / ledger-live-desktop / src / components / OperationsList / index.js View on Github external
fetchMoreOperations = () => {
    track('FetchMoreOperations')
    this.setState({ nbToShow: this.state.nbToShow + 20 })
  }
github LedgerHQ / ledger-live-desktop / src / components / modals / Send / Body.js View on Github external
next: e => {
            switch (e.type) {
              case 'signed': {
                track('SendTransactionSigned', eventProps)
                setSigned(true)
                transitionTo('confirmation')
                break
              }
              case 'broadcasted': {
                track('SendTransactionBroadcasted', eventProps)
                handleOperationBroadcasted(e.operation)
                break
              }
              default:
            }
          },
          error: err => {
github LedgerHQ / ledger-live-desktop / src / helpers / linking.js View on Github external
export const openURL = (
  url: string,
  customEventName: string = 'OpenURL',
  extraParams: Object = {},
) => {
  track(customEventName, { ...extraParams, url })
  shell && shell.openExternal(url)
}
github LedgerHQ / ledger-live-desktop / src / components / TopBar / ActivityIndicator.js View on Github external
onClick = () => {
    this.props.cvPoll()
    this.props.setSyncBehavior({ type: 'SYNC_ALL_ACCOUNTS', priority: 5 })
    this.setState({ lastClickTime: Date.now() })
    track('SyncRefreshClick')
  }
github LedgerHQ / ledger-live-desktop / src / components / RecipientAddress / index.js View on Github external
handleClickQrCode = () => {
    const { qrReaderOpened } = this.state
    this.setState(prev => ({
      qrReaderOpened: !prev.qrReaderOpened,
    }))
    !qrReaderOpened ? track('Send Flow QR Code Opened') : track('Send Flow QR Code Closed')
  }
github LedgerHQ / ledger-live-desktop / src / components / base / Button / index.js View on Github external
const onClickHandler = e => {
      if (onClick) {
        if (event) {
          track(event, eventProperties)
        }
        onClick(e)
      }
    }
    return (