Skip to content

Commit

Permalink
fix: flutter web analytics onboarding (#26687)
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto authored Dec 5, 2024
1 parent b4a3b1f commit 68e06a5
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,26 @@ export function SDKInstallFlutterInstructions(props: FlutterSetupProps): JSX.Ele
</>
)
}

export function SDKInstallFlutterTrackScreenInstructions(): JSX.Element {
return (
<>
<p>
With the <Link to="https://posthog.com/docs/libraries/flutter#example">PosthogObserver</Link> Observer,
PostHog will try to record all screen changes automatically.
</p>
<p>
If you want to manually send a new screen capture event, use the <code>screen</code> function.
</p>
<CodeSnippet language={Language.Dart}>{`import 'package:posthog_flutter/posthog_flutter.dart';
await Posthog().screen(
screenName: 'Dashboard',
properties: {
'background': 'blue',
'hero': 'superhog'
});
`}</CodeSnippet>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
AngularInstructions,
AstroInstructions,
BubbleInstructions,
FlutterInstructions,
FramerInstructions,
HTMLSnippetInstructions,
iOSInstructions,
Expand All @@ -20,12 +21,11 @@ import {
NuxtJSInstructions,
ReactInstructions,
RemixInstructions,
RNInstructions,
SvelteInstructions,
VueInstructions,
WebflowInstructions,
} from '.'
import { FlutterInstructions } from './flutter'
import { RNInstructions } from './react-native'

export const SessionReplaySDKInstructions: SDKInstructionsMap = {
[SDKKey.JS_WEB]: JSWebInstructions,
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/scenes/onboarding/sdks/session-replay/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ export * from './android'
export * from './angular'
export * from './astro'
export * from './bubble'
export * from './flutter'
export * from './framer'
export * from './html-snippet'
export * from './ios'
export * from './js-web'
export * from './next-js'
export * from './nuxt'
export * from './react'
export * from './react-native'
export * from './remix'
export * from './svelte'
export * from './vue'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { SDKInstructionsMap, SDKKey } from '~/types'

import { FlutterInstructions } from '../session-replay/flutter'
import {
AndroidInstructions,
AngularInstructions,
AstroInstructions,
BubbleInstructions,
FlutterInstructions,
FramerInstructions,
HTMLSnippetInstructions,
iOSInstructions,
Expand Down
13 changes: 13 additions & 0 deletions frontend/src/scenes/onboarding/sdks/web-analytics/flutter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { WebAnalyticsMobileFinalSteps } from 'scenes/onboarding/sdks/web-analytics/FinalSteps'

import { SDKInstallFlutterInstructions, SDKInstallFlutterTrackScreenInstructions } from '../sdk-install-instructions'

export function FlutterInstructions(): JSX.Element {
return (
<>
<SDKInstallFlutterInstructions includeReplay={false} />
<WebAnalyticsMobileFinalSteps />
<SDKInstallFlutterTrackScreenInstructions />
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export * from './android'
export * from './angular'
export * from './astro'
export * from './bubble'
export * from './flutter'
export * from './framer'
export * from './html-snippet'
export * from './ios'
Expand Down

0 comments on commit 68e06a5

Please sign in to comment.