about summary refs log tree commit diff
path: root/src/lib/analytics.web.tsx
blob: 97f456893aa5a8dc60831c21a578a53b9632a6f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import React from 'react'
import {createClient, AnalyticsProvider} from '@segment/analytics-react'
import {RootStoreModel} from 'state/models/root-store'

const segmentClient = createClient(
  {
    writeKey: '8I6DsgfiSLuoONyaunGoiQM7A6y2ybdI',
  },
  {
    integrations: {
      'Segment.io': {
        apiHost: 'api.evt.bsky.app/v1',
      },
    },
  },
)
export const track = segmentClient?.track?.bind?.(segmentClient)

export {useAnalytics} from '@segment/analytics-react'

export function init(_store: RootStoreModel) {
  // no init needed on web
}

export function Provider({children}: React.PropsWithChildren<{}>) {
  return (
    <AnalyticsProvider client={segmentClient}>{children}</AnalyticsProvider>
  )
}