diff --git a/frontend/__snapshots__/scenes-other-onboarding--onboarding-sd-ks--dark.png b/frontend/__snapshots__/scenes-other-onboarding--onboarding-sd-ks--dark.png index 3b025adbf1e77..7bee9c9dc7b4d 100644 Binary files a/frontend/__snapshots__/scenes-other-onboarding--onboarding-sd-ks--dark.png and b/frontend/__snapshots__/scenes-other-onboarding--onboarding-sd-ks--dark.png differ diff --git a/frontend/__snapshots__/scenes-other-onboarding--onboarding-sd-ks--light.png b/frontend/__snapshots__/scenes-other-onboarding--onboarding-sd-ks--light.png index d3934050a8452..5274d15770350 100644 Binary files a/frontend/__snapshots__/scenes-other-onboarding--onboarding-sd-ks--light.png and b/frontend/__snapshots__/scenes-other-onboarding--onboarding-sd-ks--light.png differ diff --git a/frontend/src/scenes/onboarding/sdks/allSDKs.tsx b/frontend/src/scenes/onboarding/sdks/allSDKs.tsx index ee375a241ee21..c9a6a88c5b3cc 100644 --- a/frontend/src/scenes/onboarding/sdks/allSDKs.tsx +++ b/frontend/src/scenes/onboarding/sdks/allSDKs.tsx @@ -20,42 +20,86 @@ export const allSDKs: SDK[] = [ docsLink: 'https://posthog.com/docs/libraries/js', }, { - name: 'React', - key: SDKKey.REACT, - tags: [SDKTag.WEB, SDKTag.RECOMMENDED], - recommended: true, - image: require('./logos/react.svg'), - docsLink: 'https://posthog.com/docs/libraries/react', + name: 'Android', + key: SDKKey.ANDROID, + tags: [SDKTag.MOBILE], + image: require('./logos/android.svg'), + docsLink: 'https://posthog.com/docs/libraries/android', }, { - name: 'Next.js', - key: SDKKey.NEXT_JS, + name: 'Angular', + key: SDKKey.ANGULAR, tags: [SDKTag.WEB], - image: require('./logos/nextjs.svg'), - docsLink: 'https://posthog.com/docs/libraries/next-js', + image: require('./logos/angular.svg'), + docsLink: 'https://posthog.com/docs/libraries/angular', }, { - name: 'Gatsby', - key: SDKKey.GATSBY, + name: 'API', + key: SDKKey.API, + tags: [SDKTag.SERVER], + image: ( + + + + ), + docsLink: 'https://posthog.com/docs/api', + }, + { + name: 'Astro', + key: SDKKey.ASTRO, tags: [SDKTag.WEB], - image: require('./logos/gatsby.svg'), - docsLink: 'https://posthog.com/docs/libraries/gatsby', + image: require('./logos/astro.svg'), + docsLink: 'https://posthog.com/docs/libraries/astro', }, { - name: 'Nuxt.js', - key: SDKKey.NUXT_JS, + name: 'Bubble', + key: SDKKey.BUBBLE, tags: [SDKTag.WEB], - image: require('./logos/nuxt.svg'), - docsLink: 'https://posthog.com/docs/libraries/nuxt-js', + image: require('./logos/bubble.svg'), + docsLink: 'https://posthog.com/docs/libraries/bubble', }, { - name: 'Vue.js', - key: SDKKey.VUE_JS, + name: 'Django', + key: SDKKey.DJANGO, + tags: [SDKTag.SERVER], + image: require('./logos/django.svg'), + docsLink: 'https://posthog.com/docs/libraries/django', + }, + { + name: 'Elixir', + key: SDKKey.ELIXIR, + tags: [SDKTag.SERVER], + image: require('./logos/elixir.svg'), + docsLink: 'https://posthog.com/docs/libraries/elixir', + }, + { + name: 'Flutter', + key: SDKKey.FLUTTER, + tags: [SDKTag.MOBILE], + image: require('./logos/flutter.svg'), + docsLink: 'https://posthog.com/docs/libraries/flutter', + }, + { + name: 'Framer', + key: SDKKey.FRAMER, tags: [SDKTag.WEB], - image: require('./logos/vue.svg'), - docsLink: 'https://posthog.com/docs/libraries/vue-js', + image: require('./logos/framer.svg'), + docsLink: 'https://posthog.com/docs/libraries/framer', + }, + { + name: 'Gatsby', + key: SDKKey.GATSBY, + tags: [SDKTag.WEB], + image: require('./logos/gatsby.svg'), + docsLink: 'https://posthog.com/docs/libraries/gatsby', + }, + { + name: 'Go', + key: SDKKey.GO, + tags: [SDKTag.SERVER], + image: require('./logos/go.svg'), + docsLink: 'https://posthog.com/docs/libraries/go', }, - // Mobile { name: 'iOS', key: SDKKey.IOS, @@ -64,27 +108,26 @@ export const allSDKs: SDK[] = [ docsLink: 'https://posthog.com/docs/libraries/ios', }, { - name: 'Android', - key: SDKKey.ANDROID, - tags: [SDKTag.MOBILE], - image: require('./logos/android.svg'), - docsLink: 'https://posthog.com/docs/libraries/android', + name: 'Java', + key: SDKKey.JAVA, + tags: [SDKTag.SERVER], + image: require('./logos/java.svg'), + docsLink: 'https://posthog.com/docs/libraries/java', }, { - name: 'React Native', - key: SDKKey.REACT_NATIVE, - tags: [SDKTag.MOBILE], - image: require('./logos/react.svg'), - docsLink: 'https://posthog.com/docs/libraries/react-native', + name: 'Laravel', + key: SDKKey.LARAVEL, + tags: [SDKTag.SERVER], + image: require('./logos/laravel.svg'), + docsLink: 'https://posthog.com/docs/libraries/laravel', }, { - name: 'Flutter', - key: SDKKey.FLUTTER, - tags: [SDKTag.MOBILE], - image: require('./logos/flutter.svg'), - docsLink: 'https://posthog.com/docs/libraries/flutter', + name: 'Next.js', + key: SDKKey.NEXT_JS, + tags: [SDKTag.WEB], + image: require('./logos/nextjs.svg'), + docsLink: 'https://posthog.com/docs/libraries/next-js', }, - // Server { name: 'Node.js', key: SDKKey.NODE_JS, @@ -94,19 +137,11 @@ export const allSDKs: SDK[] = [ docsLink: 'https://posthog.com/docs/libraries/node', }, { - name: 'Python', - key: SDKKey.PYTHON, - tags: [SDKTag.SERVER, SDKTag.RECOMMENDED], - recommended: true, - image: require('./logos/python.svg'), - docsLink: 'https://posthog.com/docs/libraries/python', - }, - { - name: 'Ruby', - key: SDKKey.RUBY, - tags: [SDKTag.SERVER], - image: require('./logos/ruby.svg'), - docsLink: 'https://posthog.com/docs/libraries/ruby', + name: 'Nuxt.js', + key: SDKKey.NUXT_JS, + tags: [SDKTag.WEB], + image: require('./logos/nuxt.svg'), + docsLink: 'https://posthog.com/docs/libraries/nuxt-js', }, { name: 'PHP', @@ -116,36 +151,41 @@ export const allSDKs: SDK[] = [ docsLink: 'https://posthog.com/docs/libraries/php', }, { - name: 'Go', - key: SDKKey.GO, - tags: [SDKTag.SERVER], - image: require('./logos/go.svg'), - docsLink: 'https://posthog.com/docs/libraries/go', + name: 'Python', + key: SDKKey.PYTHON, + tags: [SDKTag.SERVER, SDKTag.RECOMMENDED], + recommended: true, + image: require('./logos/python.svg'), + docsLink: 'https://posthog.com/docs/libraries/python', }, { - name: 'Elixir', - key: SDKKey.ELIXIR, - tags: [SDKTag.SERVER], - image: require('./logos/elixir.svg'), - docsLink: 'https://posthog.com/docs/libraries/elixir', + name: 'React', + key: SDKKey.REACT, + tags: [SDKTag.WEB, SDKTag.RECOMMENDED], + recommended: true, + image: require('./logos/react.svg'), + docsLink: 'https://posthog.com/docs/libraries/react', }, { - name: 'API', - key: SDKKey.API, - tags: [SDKTag.SERVER], - image: ( - - - - ), - docsLink: 'https://posthog.com/docs/api', + name: 'React Native', + key: SDKKey.REACT_NATIVE, + tags: [SDKTag.MOBILE], + image: require('./logos/react.svg'), + docsLink: 'https://posthog.com/docs/libraries/react-native', }, { - name: 'Java', - key: SDKKey.JAVA, + name: 'Remix', + key: SDKKey.REMIX, + tags: [SDKTag.WEB], + image: require('./logos/remix.svg'), + docsLink: 'https://posthog.com/docs/libraries/remix', + }, + { + name: 'Ruby', + key: SDKKey.RUBY, tags: [SDKTag.SERVER], - image: require('./logos/java.svg'), - docsLink: 'https://posthog.com/docs/libraries/java', + image: require('./logos/ruby.svg'), + docsLink: 'https://posthog.com/docs/libraries/ruby', }, { name: 'Rust', @@ -154,6 +194,27 @@ export const allSDKs: SDK[] = [ image: require('./logos/rust.svg'), docsLink: 'https://posthog.com/docs/libraries/rust', }, + { + name: 'Svelte', + key: SDKKey.SVELTE, + tags: [SDKTag.WEB], + image: require('./logos/svelte.svg'), + docsLink: 'https://posthog.com/docs/libraries/svelte', + }, + { + name: 'Vue.js', + key: SDKKey.VUE_JS, + tags: [SDKTag.WEB], + image: require('./logos/vue.svg'), + docsLink: 'https://posthog.com/docs/libraries/vue-js', + }, + { + name: 'Webflow', + key: SDKKey.WEBFLOW, + tags: [SDKTag.WEB], + image: require('./logos/webflow.svg'), + docsLink: 'https://posthog.com/docs/libraries/webflow', + }, // integrations { name: 'Google Tag Manager', diff --git a/frontend/src/scenes/onboarding/sdks/feature-flags/FeatureFlagsSDKInstructions.tsx b/frontend/src/scenes/onboarding/sdks/feature-flags/FeatureFlagsSDKInstructions.tsx index db8b896c25a58..ab58f83895d72 100644 --- a/frontend/src/scenes/onboarding/sdks/feature-flags/FeatureFlagsSDKInstructions.tsx +++ b/frontend/src/scenes/onboarding/sdks/feature-flags/FeatureFlagsSDKInstructions.tsx @@ -2,33 +2,54 @@ import { SDKInstructionsMap, SDKKey } from '~/types' import { FeatureFlagsAndroidInstructions, + FeatureFlagsAngularInstructions, FeatureFlagsAPIInstructions, + FeatureFlagsAstroInstructions, + FeatureFlagsBubbleInstructions, + FeatureFlagsDjangoInstructions, FeatureFlagsFlutterInstructions, + FeatureFlagsFramerInstructions, FeatureFlagsGoInstructions, FeatureFlagsIOSInstructions, FeatureFlagsJSWebInstructions, + FeatureFlagsLaravelInstructions, FeatureFlagsNextJSInstructions, FeatureFlagsNodeInstructions, + FeatureFlagsNuxtJSInstructions, FeatureFlagsPHPInstructions, FeatureFlagsPythonInstructions, FeatureFlagsReactInstructions, + FeatureFlagsRemixJSInstructions, FeatureFlagsRNInstructions, FeatureFlagsRubyInstructions, + FeatureFlagsSvelteInstructions, + FeatureFlagsVueInstructions, + FeatureFlagsWebflowInstructions, } from '.' export const FeatureFlagsSDKInstructions: SDKInstructionsMap = { [SDKKey.JS_WEB]: FeatureFlagsJSWebInstructions, - [SDKKey.REACT]: FeatureFlagsReactInstructions, - [SDKKey.NEXT_JS]: FeatureFlagsNextJSInstructions, - [SDKKey.IOS]: FeatureFlagsIOSInstructions, - [SDKKey.REACT_NATIVE]: FeatureFlagsRNInstructions, + [SDKKey.ANGULAR]: FeatureFlagsAngularInstructions, [SDKKey.ANDROID]: FeatureFlagsAndroidInstructions, + [SDKKey.API]: FeatureFlagsAPIInstructions, + [SDKKey.ASTRO]: FeatureFlagsAstroInstructions, + [SDKKey.BUBBLE]: FeatureFlagsBubbleInstructions, + [SDKKey.DJANGO]: FeatureFlagsDjangoInstructions, [SDKKey.FLUTTER]: FeatureFlagsFlutterInstructions, + [SDKKey.FRAMER]: FeatureFlagsFramerInstructions, + [SDKKey.GO]: FeatureFlagsGoInstructions, + [SDKKey.IOS]: FeatureFlagsIOSInstructions, + [SDKKey.LARAVEL]: FeatureFlagsLaravelInstructions, + [SDKKey.NEXT_JS]: FeatureFlagsNextJSInstructions, [SDKKey.NODE_JS]: FeatureFlagsNodeInstructions, + [SDKKey.NUXT_JS]: FeatureFlagsNuxtJSInstructions, + [SDKKey.PHP]: FeatureFlagsPHPInstructions, [SDKKey.PYTHON]: FeatureFlagsPythonInstructions, + [SDKKey.REACT]: FeatureFlagsReactInstructions, + [SDKKey.REACT_NATIVE]: FeatureFlagsRNInstructions, + [SDKKey.REMIX]: FeatureFlagsRemixJSInstructions, [SDKKey.RUBY]: FeatureFlagsRubyInstructions, - [SDKKey.PHP]: FeatureFlagsPHPInstructions, - [SDKKey.GO]: FeatureFlagsGoInstructions, - [SDKKey.API]: FeatureFlagsAPIInstructions, - // add rust, gatsby, nuxt, vue, svelte, and others here + [SDKKey.SVELTE]: FeatureFlagsSvelteInstructions, + [SDKKey.VUE_JS]: FeatureFlagsVueInstructions, + [SDKKey.WEBFLOW]: FeatureFlagsWebflowInstructions, } diff --git a/frontend/src/scenes/onboarding/sdks/feature-flags/angular.tsx b/frontend/src/scenes/onboarding/sdks/feature-flags/angular.tsx new file mode 100644 index 0000000000000..b4d929e5d22e5 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/feature-flags/angular.tsx @@ -0,0 +1,13 @@ +import { SDKKey } from '~/types' + +import { SDKInstallAngularInstructions } from '../sdk-install-instructions/angular' +import { FlagImplementationSnippet } from './flagImplementationSnippet' + +export function FeatureFlagsAngularInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/feature-flags/astro.tsx b/frontend/src/scenes/onboarding/sdks/feature-flags/astro.tsx new file mode 100644 index 0000000000000..faedfad4cb789 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/feature-flags/astro.tsx @@ -0,0 +1,13 @@ +import { SDKKey } from '~/types' + +import { SDKInstallAstroInstructions } from '../sdk-install-instructions/astro' +import { FlagImplementationSnippet } from './flagImplementationSnippet' + +export function FeatureFlagsAstroInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/feature-flags/bubble.tsx b/frontend/src/scenes/onboarding/sdks/feature-flags/bubble.tsx new file mode 100644 index 0000000000000..d529ef3b5d6a6 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/feature-flags/bubble.tsx @@ -0,0 +1,13 @@ +import { SDKKey } from '~/types' + +import { SDKInstallBubbleInstructions } from '../sdk-install-instructions/bubble' +import { FlagImplementationSnippet } from './flagImplementationSnippet' + +export function FeatureFlagsBubbleInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/feature-flags/django.tsx b/frontend/src/scenes/onboarding/sdks/feature-flags/django.tsx new file mode 100644 index 0000000000000..6f6e3043e9377 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/feature-flags/django.tsx @@ -0,0 +1,13 @@ +import { SDKKey } from '~/types' + +import { SDKInstallDjangoInstructions } from '../sdk-install-instructions' +import { FlagImplementationSnippet } from './flagImplementationSnippet' + +export function FeatureFlagsDjangoInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/feature-flags/framer.tsx b/frontend/src/scenes/onboarding/sdks/feature-flags/framer.tsx new file mode 100644 index 0000000000000..0212ac657c8e1 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/feature-flags/framer.tsx @@ -0,0 +1,13 @@ +import { SDKKey } from '~/types' + +import { SDKInstallFramerInstructions } from '../sdk-install-instructions/framer' +import { FlagImplementationSnippet } from './flagImplementationSnippet' + +export function FeatureFlagsFramerInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/feature-flags/index.tsx b/frontend/src/scenes/onboarding/sdks/feature-flags/index.tsx index c7a6d79949424..83d8dd502923b 100644 --- a/frontend/src/scenes/onboarding/sdks/feature-flags/index.tsx +++ b/frontend/src/scenes/onboarding/sdks/feature-flags/index.tsx @@ -1,13 +1,24 @@ export * from './android' +export * from './angular' export * from './api' +export * from './astro' +export * from './bubble' +export * from './django' export * from './flutter' +export * from './framer' export * from './go' export * from './ios' export * from './js-web' +export * from './laravel' export * from './next-js' export * from './nodejs' +export * from './nuxt' export * from './php' export * from './python' export * from './react' export * from './react-native' +export * from './remix' export * from './ruby' +export * from './svelte' +export * from './vue' +export * from './webflow' diff --git a/frontend/src/scenes/onboarding/sdks/feature-flags/laravel.tsx b/frontend/src/scenes/onboarding/sdks/feature-flags/laravel.tsx new file mode 100644 index 0000000000000..bc3b80d4417fd --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/feature-flags/laravel.tsx @@ -0,0 +1,13 @@ +import { SDKKey } from '~/types' + +import { SDKInstallLaravelInstructions } from '../sdk-install-instructions' +import { FlagImplementationSnippet } from './flagImplementationSnippet' + +export function FeatureFlagsLaravelInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/feature-flags/nuxt.tsx b/frontend/src/scenes/onboarding/sdks/feature-flags/nuxt.tsx new file mode 100644 index 0000000000000..2d0854bd3011a --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/feature-flags/nuxt.tsx @@ -0,0 +1,21 @@ +import { SDKKey } from '~/types' + +import { NodeInstallSnippet, NodeSetupSnippet } from '../sdk-install-instructions' +import { SDKInstallNuxtJSInstructions } from '../sdk-install-instructions/nuxt' +import { FlagImplementationSnippet } from './flagImplementationSnippet' + +export function FeatureFlagsNuxtJSInstructions(): JSX.Element { + return ( + <> + +

Client-side rendering

+ +

Server-side rendering

+

Install

+ +

Configure

+ + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/feature-flags/remix.tsx b/frontend/src/scenes/onboarding/sdks/feature-flags/remix.tsx new file mode 100644 index 0000000000000..3ed90cab39edc --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/feature-flags/remix.tsx @@ -0,0 +1,21 @@ +import { SDKKey } from '~/types' + +import { NodeInstallSnippet, NodeSetupSnippet } from '../sdk-install-instructions' +import { SDKInstallRemixJSInstructions } from '../sdk-install-instructions/remix' +import { FlagImplementationSnippet } from './flagImplementationSnippet' + +export function FeatureFlagsRemixJSInstructions(): JSX.Element { + return ( + <> + +

Client-side rendering

+ +

Server-side rendering

+

Install

+ +

Configure

+ + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/feature-flags/svelte.tsx b/frontend/src/scenes/onboarding/sdks/feature-flags/svelte.tsx new file mode 100644 index 0000000000000..74349718ac517 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/feature-flags/svelte.tsx @@ -0,0 +1,21 @@ +import { SDKKey } from '~/types' + +import { NodeInstallSnippet, NodeSetupSnippet } from '../sdk-install-instructions' +import { SDKInstallSvelteJSInstructions } from '../sdk-install-instructions/svelte' +import { FlagImplementationSnippet } from './flagImplementationSnippet' + +export function FeatureFlagsSvelteInstructions(): JSX.Element { + return ( + <> + +

Client-side rendering

+ +

Server-side rendering

+

Install

+ +

Configure

+ + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/feature-flags/vue.tsx b/frontend/src/scenes/onboarding/sdks/feature-flags/vue.tsx new file mode 100644 index 0000000000000..eec3c3d13f093 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/feature-flags/vue.tsx @@ -0,0 +1,13 @@ +import { SDKKey } from '~/types' + +import { SDKInstallVueInstructions } from '../sdk-install-instructions/vue' +import { FlagImplementationSnippet } from './flagImplementationSnippet' + +export function FeatureFlagsVueInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/feature-flags/webflow.tsx b/frontend/src/scenes/onboarding/sdks/feature-flags/webflow.tsx new file mode 100644 index 0000000000000..3f4cbf0c157a7 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/feature-flags/webflow.tsx @@ -0,0 +1,13 @@ +import { SDKKey } from '~/types' + +import { SDKInstallWebflowInstructions } from '../sdk-install-instructions/webflow' +import { FlagImplementationSnippet } from './flagImplementationSnippet' + +export function FeatureFlagsWebflowInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/logos/angular.svg b/frontend/src/scenes/onboarding/sdks/logos/angular.svg new file mode 100644 index 0000000000000..bf081acb12952 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/logos/angular.svg @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/frontend/src/scenes/onboarding/sdks/logos/astro.svg b/frontend/src/scenes/onboarding/sdks/logos/astro.svg new file mode 100644 index 0000000000000..52b76d550913d --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/logos/astro.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/frontend/src/scenes/onboarding/sdks/logos/bubble.svg b/frontend/src/scenes/onboarding/sdks/logos/bubble.svg new file mode 100644 index 0000000000000..abc0672e53e6d --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/logos/bubble.svg @@ -0,0 +1,8 @@ + + + Bubble + + + + + diff --git a/frontend/src/scenes/onboarding/sdks/logos/django.svg b/frontend/src/scenes/onboarding/sdks/logos/django.svg new file mode 100644 index 0000000000000..69a4642491753 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/logos/django.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/src/scenes/onboarding/sdks/logos/flask.svg b/frontend/src/scenes/onboarding/sdks/logos/flask.svg new file mode 100644 index 0000000000000..df0987bf64edd --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/logos/flask.svg @@ -0,0 +1,6 @@ + + + +flask + + \ No newline at end of file diff --git a/frontend/src/scenes/onboarding/sdks/logos/framer.svg b/frontend/src/scenes/onboarding/sdks/logos/framer.svg new file mode 100644 index 0000000000000..7d8f4e2a03eef --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/logos/framer.svg @@ -0,0 +1,2 @@ + +Framer icon \ No newline at end of file diff --git a/frontend/src/scenes/onboarding/sdks/logos/laravel.svg b/frontend/src/scenes/onboarding/sdks/logos/laravel.svg new file mode 100644 index 0000000000000..e1309dd21e8b9 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/logos/laravel.svg @@ -0,0 +1 @@ +Logomark \ No newline at end of file diff --git a/frontend/src/scenes/onboarding/sdks/logos/remix.svg b/frontend/src/scenes/onboarding/sdks/logos/remix.svg new file mode 100644 index 0000000000000..24b949f646f37 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/logos/remix.svg @@ -0,0 +1,7 @@ + + + Shape + + + + \ No newline at end of file diff --git a/frontend/src/scenes/onboarding/sdks/logos/svelte.svg b/frontend/src/scenes/onboarding/sdks/logos/svelte.svg new file mode 100644 index 0000000000000..4bf279659a930 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/logos/svelte.svg @@ -0,0 +1,20 @@ + + + + + + + diff --git a/frontend/src/scenes/onboarding/sdks/logos/webflow.svg b/frontend/src/scenes/onboarding/sdks/logos/webflow.svg new file mode 100644 index 0000000000000..90241e04d9b86 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/logos/webflow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/src/scenes/onboarding/sdks/product-analytics/ProductAnalyticsSDKInstructions.tsx b/frontend/src/scenes/onboarding/sdks/product-analytics/ProductAnalyticsSDKInstructions.tsx index c6bc257335e44..d435dc8bfa3ad 100644 --- a/frontend/src/scenes/onboarding/sdks/product-analytics/ProductAnalyticsSDKInstructions.tsx +++ b/frontend/src/scenes/onboarding/sdks/product-analytics/ProductAnalyticsSDKInstructions.tsx @@ -4,33 +4,54 @@ import { HTMLSnippetInstructions, JSWebInstructions, ProductAnalyticsAndroidInstructions, + ProductAnalyticsAngularInstructions, ProductAnalyticsAPIInstructions, + ProductAnalyticsAstroInstructions, + ProductAnalyticsBubbleInstructions, + ProductAnalyticsDjangoInstructions, ProductAnalyticsElixirInstructions, ProductAnalyticsFlutterInstructions, + ProductAnalyticsFramerInstructions, ProductAnalyticsGoInstructions, ProductAnalyticsIOSInstructions, + ProductAnalyticsLaravelInstructions, ProductAnalyticsNextJSInstructions, ProductAnalyticsNodeInstructions, + ProductAnalyticsNuxtJSInstructions, ProductAnalyticsPHPInstructions, ProductAnalyticsPythonInstructions, + ProductAnalyticsRemixJSInstructions, ProductAnalyticsRNInstructions, ProductAnalyticsRubyInstructions, + ProductAnalyticsSvelteJSInstructions, + ProductAnalyticsVueInstructions, + ProductAnalyticsWebflowInstructions, } from '.' export const ProductAnalyticsSDKInstructions: SDKInstructionsMap = { [SDKKey.JS_WEB]: JSWebInstructions, - [SDKKey.HTML_SNIPPET]: HTMLSnippetInstructions, - [SDKKey.NEXT_JS]: ProductAnalyticsNextJSInstructions, - // add getsby and other frameworks here - [SDKKey.IOS]: ProductAnalyticsIOSInstructions, - [SDKKey.REACT_NATIVE]: ProductAnalyticsRNInstructions, [SDKKey.ANDROID]: ProductAnalyticsAndroidInstructions, + [SDKKey.ANGULAR]: ProductAnalyticsAngularInstructions, + [SDKKey.API]: ProductAnalyticsAPIInstructions, + [SDKKey.ASTRO]: ProductAnalyticsAstroInstructions, + [SDKKey.BUBBLE]: ProductAnalyticsBubbleInstructions, + [SDKKey.DJANGO]: ProductAnalyticsDjangoInstructions, + [SDKKey.ELIXIR]: ProductAnalyticsElixirInstructions, [SDKKey.FLUTTER]: ProductAnalyticsFlutterInstructions, + [SDKKey.FRAMER]: ProductAnalyticsFramerInstructions, + [SDKKey.GO]: ProductAnalyticsGoInstructions, + [SDKKey.HTML_SNIPPET]: HTMLSnippetInstructions, + [SDKKey.IOS]: ProductAnalyticsIOSInstructions, + [SDKKey.LARAVEL]: ProductAnalyticsLaravelInstructions, + [SDKKey.NEXT_JS]: ProductAnalyticsNextJSInstructions, [SDKKey.NODE_JS]: ProductAnalyticsNodeInstructions, + [SDKKey.NUXT_JS]: ProductAnalyticsNuxtJSInstructions, + [SDKKey.PHP]: ProductAnalyticsPHPInstructions, [SDKKey.PYTHON]: ProductAnalyticsPythonInstructions, + [SDKKey.REACT_NATIVE]: ProductAnalyticsRNInstructions, + [SDKKey.REMIX]: ProductAnalyticsRemixJSInstructions, [SDKKey.RUBY]: ProductAnalyticsRubyInstructions, - [SDKKey.PHP]: ProductAnalyticsPHPInstructions, - [SDKKey.GO]: ProductAnalyticsGoInstructions, - [SDKKey.ELIXIR]: ProductAnalyticsElixirInstructions, - [SDKKey.API]: ProductAnalyticsAPIInstructions, + [SDKKey.SVELTE]: ProductAnalyticsSvelteJSInstructions, + [SDKKey.VUE_JS]: ProductAnalyticsVueInstructions, + [SDKKey.WEBFLOW]: ProductAnalyticsWebflowInstructions, } diff --git a/frontend/src/scenes/onboarding/sdks/product-analytics/angular.tsx b/frontend/src/scenes/onboarding/sdks/product-analytics/angular.tsx new file mode 100644 index 0000000000000..223b29928a8bc --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/product-analytics/angular.tsx @@ -0,0 +1,14 @@ +import { LemonDivider } from '@posthog/lemon-ui' + +import { SDKInstallAngularInstructions } from '../sdk-install-instructions/angular' +import { ProductAnalyticsAllJSFinalSteps } from './AllJSFinalSteps' + +export function ProductAnalyticsAngularInstructions(): JSX.Element { + return ( + <> + + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/product-analytics/astro.tsx b/frontend/src/scenes/onboarding/sdks/product-analytics/astro.tsx new file mode 100644 index 0000000000000..c2b4bbd2316c1 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/product-analytics/astro.tsx @@ -0,0 +1,11 @@ +import { SDKInstallAstroInstructions } from '../sdk-install-instructions/astro' +import { ProductAnalyticsAllJSFinalSteps } from './AllJSFinalSteps' + +export function ProductAnalyticsAstroInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/product-analytics/bubble.tsx b/frontend/src/scenes/onboarding/sdks/product-analytics/bubble.tsx new file mode 100644 index 0000000000000..b55883bdcb27b --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/product-analytics/bubble.tsx @@ -0,0 +1,11 @@ +import { SDKInstallBubbleInstructions } from '../sdk-install-instructions/bubble' +import { ProductAnalyticsAllJSFinalSteps } from './AllJSFinalSteps' + +export function ProductAnalyticsBubbleInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/product-analytics/django.tsx b/frontend/src/scenes/onboarding/sdks/product-analytics/django.tsx new file mode 100644 index 0000000000000..8729c42c514a1 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/product-analytics/django.tsx @@ -0,0 +1,21 @@ +import { CodeSnippet, Language } from 'lib/components/CodeSnippet' + +import { SDKInstallDjangoInstructions } from '../sdk-install-instructions' + +function DjangoCaptureSnippet(): JSX.Element { + return ( + {`import posthog + +posthog.capture('test-id', 'test-event')`} + ) +} + +export function ProductAnalyticsDjangoInstructions(): JSX.Element { + return ( + <> + +

Send an Event

+ + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/product-analytics/framer.tsx b/frontend/src/scenes/onboarding/sdks/product-analytics/framer.tsx new file mode 100644 index 0000000000000..9b9a46b0988f0 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/product-analytics/framer.tsx @@ -0,0 +1,11 @@ +import { SDKInstallFramerInstructions } from '../sdk-install-instructions/framer' +import { ProductAnalyticsAllJSFinalSteps } from './AllJSFinalSteps' + +export function ProductAnalyticsFramerInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/product-analytics/index.tsx b/frontend/src/scenes/onboarding/sdks/product-analytics/index.tsx index 291d5555184a4..bf5c8678d04a1 100644 --- a/frontend/src/scenes/onboarding/sdks/product-analytics/index.tsx +++ b/frontend/src/scenes/onboarding/sdks/product-analytics/index.tsx @@ -1,14 +1,25 @@ export * from './android' +export * from './angular' export * from './api' +export * from './astro' +export * from './bubble' +export * from './django' export * from './elixir' export * from './flutter' +export * from './framer' export * from './go' export * from './html-snippet' export * from './ios' export * from './js-web' +export * from './laravel' export * from './next-js' export * from './nodejs' +export * from './nuxt' export * from './php' export * from './python' export * from './react-native' +export * from './remix' export * from './ruby' +export * from './svelte' +export * from './vue' +export * from './webflow' diff --git a/frontend/src/scenes/onboarding/sdks/product-analytics/laravel.tsx b/frontend/src/scenes/onboarding/sdks/product-analytics/laravel.tsx new file mode 100644 index 0000000000000..c8bca7f9a2397 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/product-analytics/laravel.tsx @@ -0,0 +1,21 @@ +import { CodeSnippet, Language } from 'lib/components/CodeSnippet' + +import { SDKInstallLaravelInstructions } from '../sdk-install-instructions' + +function LaravelCaptureSnippet(): JSX.Element { + return ( + + {"PostHog::capture(array(\n 'distinctId' => 'test-user',\n 'event' => 'test-event'\n));"} + + ) +} + +export function ProductAnalyticsLaravelInstructions(): JSX.Element { + return ( + <> + +

Send an Event

+ + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/product-analytics/nuxt.tsx b/frontend/src/scenes/onboarding/sdks/product-analytics/nuxt.tsx new file mode 100644 index 0000000000000..c2ddf2f83d817 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/product-analytics/nuxt.tsx @@ -0,0 +1,11 @@ +import { SDKInstallNuxtJSInstructions } from '../sdk-install-instructions/nuxt' +import { ProductAnalyticsAllJSFinalSteps } from './AllJSFinalSteps' + +export function ProductAnalyticsNuxtJSInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/product-analytics/remix.tsx b/frontend/src/scenes/onboarding/sdks/product-analytics/remix.tsx new file mode 100644 index 0000000000000..ff093e84de046 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/product-analytics/remix.tsx @@ -0,0 +1,11 @@ +import { SDKInstallRemixJSInstructions } from '../sdk-install-instructions/remix' +import { ProductAnalyticsAllJSFinalSteps } from './AllJSFinalSteps' + +export function ProductAnalyticsRemixJSInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/product-analytics/svelte.tsx b/frontend/src/scenes/onboarding/sdks/product-analytics/svelte.tsx new file mode 100644 index 0000000000000..8c60a6e20ee6a --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/product-analytics/svelte.tsx @@ -0,0 +1,11 @@ +import { SDKInstallSvelteJSInstructions } from '../sdk-install-instructions/svelte' +import { ProductAnalyticsAllJSFinalSteps } from './AllJSFinalSteps' + +export function ProductAnalyticsSvelteJSInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/product-analytics/vue.tsx b/frontend/src/scenes/onboarding/sdks/product-analytics/vue.tsx new file mode 100644 index 0000000000000..f4646bb7867c2 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/product-analytics/vue.tsx @@ -0,0 +1,11 @@ +import { SDKInstallVueInstructions } from '../sdk-install-instructions/vue' +import { ProductAnalyticsAllJSFinalSteps } from './AllJSFinalSteps' + +export function ProductAnalyticsVueInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/product-analytics/webflow.tsx b/frontend/src/scenes/onboarding/sdks/product-analytics/webflow.tsx new file mode 100644 index 0000000000000..3edc373793c54 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/product-analytics/webflow.tsx @@ -0,0 +1,11 @@ +import { SDKInstallWebflowInstructions } from '../sdk-install-instructions/webflow' +import { ProductAnalyticsAllJSFinalSteps } from './AllJSFinalSteps' + +export function ProductAnalyticsWebflowInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/angular.tsx b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/angular.tsx new file mode 100644 index 0000000000000..7587684b9d07b --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/angular.tsx @@ -0,0 +1,60 @@ +import { useValues } from 'kea' +import { CodeSnippet, Language } from 'lib/components/CodeSnippet' +import { apiHostOrigin } from 'lib/utils/apiHost' +import { teamLogic } from 'scenes/teamLogic' + +import { JSInstallSnippet } from './js-web' + +function EnvVarsSnippet(): JSX.Element { + const { currentTeam } = useValues(teamLogic) + + return ( + + {[`POSTHOG_KEY=${currentTeam?.api_token}`, `POSTHOG_HOST=${apiHostOrigin()}`].join('\n')} + + ) +} + +function AngularInitializeCodeSnippet(): JSX.Element { + return ( + + {`// in src/main.ts + +import { bootstrapApplication } from '@angular/platform-browser'; +import { appConfig } from './app/app.config'; +import { AppComponent } from './app/app.component'; +import posthog from 'posthog-js' + +posthog.init( + process.env.POSTHOG_KEY, + { + api_host:process.env.POSTHOG_HOST + } +) + +bootstrapApplication(AppComponent, appConfig) + .catch((err) => console.error(err));`} + + ) +} + +export function SDKInstallAngularInstructions(): JSX.Element { + return ( + <> +

Install posthog-js using your package manager

+ +

Add environment variables

+

+ Add your environment variables to your .env.local file and to your hosting provider (e.g. Vercel, + Netlify, AWS). You can find your project API key in your project settings. +

+ + +

Initialize

+

+ In your src/main.ts, initialize PostHog using your project API key and instance address: +

+ + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/astro.tsx b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/astro.tsx new file mode 100644 index 0000000000000..1eb2b020e6d52 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/astro.tsx @@ -0,0 +1,46 @@ +import { useValues } from 'kea' +import { CodeSnippet, Language } from 'lib/components/CodeSnippet' +import { apiHostOrigin } from 'lib/utils/apiHost' +import { teamLogic } from 'scenes/teamLogic' + +function CreatePostHogAstroFileSnippet(): JSX.Element { + return ( + + {`cd ./src/components +# or 'cd ./src && mkdir components && cd ./components' if your components folder doesn't exist +touch posthog.astro`} + + ) +} + +function AstroSetupSnippet(): JSX.Element { + const { currentTeam } = useValues(teamLogic) + return ( + <> + + {`--- + +--- + +`} + + + ) +} + +export function SDKInstallAstroInstructions(): JSX.Element { + return ( + <> +

Install the PostHog web snippet

+

+ In your src/components folder, create a posthog.astro file: +

+ +

In this file, add your PostHog web snippet:

+ + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/bubble.tsx b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/bubble.tsx new file mode 100644 index 0000000000000..69c218d5a109c --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/bubble.tsx @@ -0,0 +1,24 @@ +import { JSSnippet } from 'lib/components/JSSnippet' + +export function SDKInstallBubbleInstructions(): JSX.Element { + return ( + <> +

Install the PostHog web snippet

+

First copy your web snippet:

+ +

+ Go to your Bubble site settings by clicking on the icon in the left-hand menu. If you haven’t already, + sign up for at least the Starter site plan. This enables you to add custom code. Then: +

+
    +
  1. + Go to the SEO / metatags tab in site settings. +
  2. +
  3. + Paste your PostHog snippet in the Script/meta tags in header section. +
  4. +
  5. Deploy your site to live.
  6. +
+ + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/django.tsx b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/django.tsx new file mode 100644 index 0000000000000..aee7182c84c6a --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/django.tsx @@ -0,0 +1,55 @@ +import { useValues } from 'kea' +import { CodeSnippet, Language } from 'lib/components/CodeSnippet' +import { apiHostOrigin } from 'lib/utils/apiHost' +import { teamLogic } from 'scenes/teamLogic' + +function DjangoInstallSnippet(): JSX.Element { + return pip install posthog +} + +function DjangoAppConfigSnippet(): JSX.Element { + const { currentTeam } = useValues(teamLogic) + + return ( + + {`from django.apps import AppConfig +import posthog + +class YourAppConfig(AppConfig): + name = "your_app_name" + def ready(self): + posthog.api_key = '${currentTeam?.api_token}' + posthog.host = '${apiHostOrigin()}'`} + + ) +} + +function DjangoSettingsSnippet(): JSX.Element { + return ( + + {`INSTALLED_APPS = [ + # other apps + 'your_app_name.apps.MyAppConfig', # Add your app config +] `} + + ) +} + +export function SDKInstallDjangoInstructions(): JSX.Element { + return ( + <> +

Install

+ +

Configure

+

+ Set the PostHog API key and host in your AppConfig in apps.py so that's it's + available everywhere: +

+ +

+ Next, if you haven't done so already, make sure you add your AppConfig to your{' '} + settings.py under INSTALLED_APPS: + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/framer.tsx b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/framer.tsx new file mode 100644 index 0000000000000..3208cd09cd1ab --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/framer.tsx @@ -0,0 +1,32 @@ +import { JSSnippet } from 'lib/components/JSSnippet' + +export function SDKInstallFramerInstructions(): JSX.Element { + return ( + <> +

Install the PostHog web snippet

+

First copy your web snippet:

+ +

+ Then go to your Framer project settings by clicking the gear in the top right. If you haven’t already, + sign up for at least the Mini site plan. This enables you to add custom code. Then: +

+
    +
  1. + Go to the General tab in site settings. +
  2. +
  3. + Scroll down to the Custom Code section. +
  4. +
  5. + {' '} + Under{' '} + + End of <head> tag + + , paste your PostHog snippet. +
  6. +
  7. Press save, and then publish your site.
  8. +
+ + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/index.tsx b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/index.tsx index 0765b5bbf12f6..45ffdf34a9919 100644 --- a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/index.tsx +++ b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/index.tsx @@ -1,11 +1,22 @@ export * from './android' +export * from './angular' +export * from './astro' +export * from './bubble' +export * from './django' export * from './elixir' export * from './flutter' +export * from './framer' export * from './go' export * from './ios' export * from './js-web' +export * from './laravel' export * from './nodejs' +export * from './nuxt' export * from './php' export * from './python' export * from './react-native' +export * from './remix' export * from './ruby' +export * from './svelte' +export * from './vue' +export * from './webflow' diff --git a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/laravel.tsx b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/laravel.tsx new file mode 100644 index 0000000000000..55ff388d95ad5 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/laravel.tsx @@ -0,0 +1,51 @@ +import { useValues } from 'kea' +import { CodeSnippet, Language } from 'lib/components/CodeSnippet' +import { apiHostOrigin } from 'lib/utils/apiHost' +import { teamLogic } from 'scenes/teamLogic' + +function LaravelConfigSnippet(): JSX.Element { + return composer require posthog/posthog-php +} + +function LaravelInstallSnippet(): JSX.Element { + const { currentTeam } = useValues(teamLogic) + + return ( + + {` '${apiHostOrigin()}' + ] + ); + } +} +`} + + ) +} + +export function SDKInstallLaravelInstructions(): JSX.Element { + return ( + <> +

Dependency Setup

+ +

Configure

+

+ Initialize PostHog in the boot method of app/Providers/AppServiceProvider.php +

+ + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/nuxt.tsx b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/nuxt.tsx new file mode 100644 index 0000000000000..188fe24cd517d --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/nuxt.tsx @@ -0,0 +1,87 @@ +import { useValues } from 'kea' +import { CodeSnippet, Language } from 'lib/components/CodeSnippet' +import { Link } from 'lib/lemon-ui/Link' +import { apiHostOrigin } from 'lib/utils/apiHost' +import { teamLogic } from 'scenes/teamLogic' + +import { JSInstallSnippet } from './js-web' + +function NuxtEnvVarsSnippet(): JSX.Element { + const { currentTeam } = useValues(teamLogic) + + return ( + + {`export default defineNuxtConfig({ + runtimeConfig: { + public: { + posthogPublicKey: '${currentTeam?.api_token}', + posthogHost: '${apiHostOrigin()}' + } + } + })`} + + ) +} + +function NuxtAppClientCodeSnippet(): JSX.Element { + return ( + + {`import { defineNuxtPlugin } from '#app' +import posthog from 'posthog-js' +export default defineNuxtPlugin(nuxtApp => { + const runtimeConfig = useRuntimeConfig(); + const posthogClient = posthog.init(runtimeConfig.public.posthogPublicKey, { + api_host: runtimeConfig.public.posthogHost', + capture_pageview: false, // we add manual pageview capturing below + loaded: (posthog) => { + if (import.meta.env.MODE === 'development') posthog.debug(); + } + }) + + // Make sure that pageviews are captured with each route change + const router = useRouter(); + router.afterEach((to) => { + nextTick(() => { + posthog.capture('$pageview', { + current_url: to.fullPath + }); + }); + }); + + return { + provide: { + posthog: () => posthogClient + } + } +})`} + + ) +} + +export function SDKInstallNuxtJSInstructions(): JSX.Element { + return ( + <> +

+ The below guide is for Nuxt v3.0 and above. For Nuxt v2.16 and below, see our{' '} + Nuxt docs +

+

Install posthog-js using your package manager

+ +

Add environment variables

+

+ Add your PostHog API key and host to your nuxt.config.js file. +

+ + +

Create a plugin

+

+ Create a new plugin by creating a new file posthog.client.js in your{' '} + + plugins directory + + : +

+ + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/remix.tsx b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/remix.tsx new file mode 100644 index 0000000000000..9f2aaf5565e2a --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/remix.tsx @@ -0,0 +1,54 @@ +import { useValues } from 'kea' +import { CodeSnippet, Language } from 'lib/components/CodeSnippet' +import { apiHostOrigin } from 'lib/utils/apiHost' +import { teamLogic } from 'scenes/teamLogic' + +import { JSInstallSnippet } from './js-web' + +function RemixAppClientCodeSnippet(): JSX.Element { + const { currentTeam } = useValues(teamLogic) + + return ( + + {`import { RemixBrowser } from "@remix-run/react"; +import { startTransition, StrictMode, useEffect } from "react"; +import { hydrateRoot } from "react-dom/client"; +import posthog from "posthog-js"; + +function PosthogInit() { + useEffect(() => { + posthog.init('${currentTeam?.api_token}', { + api_host: '${apiHostOrigin()}', + }); + }, []); + + return null; +} + +startTransition(() => { + hydrateRoot( + document, + + + + + ); +});`} + + ) +} + +export function SDKInstallRemixJSInstructions(): JSX.Element { + return ( + <> +

Install posthog-js using your package manager

+ + +

Initialize

+

+ Go to your app/entry.client.tsx file and initialize PostHog as a component: +

+ + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/svelte.tsx b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/svelte.tsx new file mode 100644 index 0000000000000..141de4ab8acc3 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/svelte.tsx @@ -0,0 +1,49 @@ +import { Link } from '@posthog/lemon-ui' +import { useValues } from 'kea' +import { CodeSnippet, Language } from 'lib/components/CodeSnippet' +import { apiHostOrigin } from 'lib/utils/apiHost' +import { teamLogic } from 'scenes/teamLogic' + +import { JSInstallSnippet } from './js-web' + +function SvelteAppClientCodeSnippet(): JSX.Element { + const { currentTeam } = useValues(teamLogic) + + return ( + + {`import posthog from 'posthog-js' +import { browser } from '$app/environment'; + +export const load = async () => { + + if (browser) { + posthog.init( + '${currentTeam?.api_token}', + { api_host: "${apiHostOrigin()}" } + ) + } + return +};`} + + ) +} + +export function SDKInstallSvelteJSInstructions(): JSX.Element { + return ( + <> +

Install posthog-js using your package manager

+ + +

Initialize

+

+ If you haven't created a root{' '} + + layout + {' '} + already, create a new file called +layout.js in your src/routes folder. In + this file, check the environment is the browser, and initialize PostHog if so: +

+ + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/vue.tsx b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/vue.tsx new file mode 100644 index 0000000000000..9bd3eb224ec10 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/vue.tsx @@ -0,0 +1,78 @@ +import { useValues } from 'kea' +import { CodeSnippet, Language } from 'lib/components/CodeSnippet' +import { Link } from 'lib/lemon-ui/Link' +import { apiHostOrigin } from 'lib/utils/apiHost' +import { teamLogic } from 'scenes/teamLogic' + +import { JSInstallSnippet } from './js-web' + +function VueCreatePluginsFileSnippet(): JSX.Element { + return ( + + {`mkdir plugins #skip if you already have one +cd plugins +touch posthog.js`} + + ) +} + +function VuePluginsCodeSnippet(): JSX.Element { + const { currentTeam } = useValues(teamLogic) + + return ( + + {`//./plugins/posthog.js +import posthog from "posthog-js"; + +export default { + install(app) { + app.config.globalProperties.$posthog = posthog.init( + '${currentTeam?.api_token}', + { + api_host: '${apiHostOrigin()}', + } + ); + }, +};`} + + ) +} + +function VueActivatePluginSnippet(): JSX.Element { + return ( + + {`//main.js +import { createApp } from 'vue' +import App from './App.vue' +import posthogPlugin from "./plugins/posthog"; //import the plugin. + +const app = createApp(App); + +app.use(posthogPlugin); //install the plugin +app.mount('#app')`} + + ) +} + +export function SDKInstallVueInstructions(): JSX.Element { + return ( + <> +

+ The below guide is for integrating using plugins in Vue versions 3 and above. For integrating PostHog + using Provide/inject, Vue.prototype, or versions 2.7 and below, see our{' '} + Vue docs +

+

Install posthog-js using your package manager

+ +

Create a plugin

+

+ Create a new file posthog.js in your plugins directory: +

+ + Add the following code to posthog.js: + +

Activate your plugin

+ + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/webflow.tsx b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/webflow.tsx new file mode 100644 index 0000000000000..c0f45d721f6b1 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/webflow.tsx @@ -0,0 +1,24 @@ +import { JSSnippet } from 'lib/components/JSSnippet' + +export function SDKInstallWebflowInstructions(): JSX.Element { + return ( + <> +

Install the PostHog web snippet

+

First copy your web snippet:

+ +

+ Go to your Webflow site settings by clicking on the menu icon in the top left. If you haven’t already, + sign up for at least the Basic site plan. This enables you to add custom code. Then: +

+
    +
  1. + Go to the Custom code tab in site settings. +
  2. +
  3. + In the Head code section, paste your PostHog snippet and press save. +
  4. +
  5. Publish your site.
  6. +
+ + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/session-replay/SessionReplaySDKInstructions.tsx b/frontend/src/scenes/onboarding/sdks/session-replay/SessionReplaySDKInstructions.tsx index 16db14dbd1d85..b8fc50a5bd38a 100644 --- a/frontend/src/scenes/onboarding/sdks/session-replay/SessionReplaySDKInstructions.tsx +++ b/frontend/src/scenes/onboarding/sdks/session-replay/SessionReplaySDKInstructions.tsx @@ -1,12 +1,33 @@ import { SDKInstructionsMap, SDKKey } from '~/types' -import { HTMLSnippetInstructions, JSWebInstructions, NextJSInstructions, ReactInstructions } from '.' +import { + AngularInstructions, + AstroInstructions, + BubbleInstructions, + FramerInstructions, + HTMLSnippetInstructions, + JSWebInstructions, + NextJSInstructions, + NuxtJSInstructions, + ReactInstructions, + RemixInstructions, + SvelteInstructions, + VueInstructions, + WebflowInstructions, +} from '.' export const SessionReplaySDKInstructions: SDKInstructionsMap = { [SDKKey.JS_WEB]: JSWebInstructions, [SDKKey.HTML_SNIPPET]: HTMLSnippetInstructions, + [SDKKey.ANGULAR]: AngularInstructions, + [SDKKey.ASTRO]: AstroInstructions, + [SDKKey.BUBBLE]: BubbleInstructions, + [SDKKey.FRAMER]: FramerInstructions, [SDKKey.NEXT_JS]: NextJSInstructions, + [SDKKey.NUXT_JS]: NuxtJSInstructions, [SDKKey.REACT]: ReactInstructions, - // added by feature flag in Onboarding.tsx until released - //[SDKKey.ANDROID]: AndroidInstructions, + [SDKKey.REMIX]: RemixInstructions, + [SDKKey.SVELTE]: SvelteInstructions, + [SDKKey.VUE_JS]: VueInstructions, + [SDKKey.WEBFLOW]: WebflowInstructions, } diff --git a/frontend/src/scenes/onboarding/sdks/session-replay/angular.tsx b/frontend/src/scenes/onboarding/sdks/session-replay/angular.tsx new file mode 100644 index 0000000000000..c8cc574248356 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/session-replay/angular.tsx @@ -0,0 +1,11 @@ +import { SDKInstallAngularInstructions } from '../sdk-install-instructions' +import { SessionReplayFinalSteps } from '../shared-snippets' + +export function AngularInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/session-replay/astro.tsx b/frontend/src/scenes/onboarding/sdks/session-replay/astro.tsx new file mode 100644 index 0000000000000..a9a01c411e2b0 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/session-replay/astro.tsx @@ -0,0 +1,11 @@ +import { SDKInstallAstroInstructions } from '../sdk-install-instructions' +import { SessionReplayFinalSteps } from '../shared-snippets' + +export function AstroInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/session-replay/bubble.tsx b/frontend/src/scenes/onboarding/sdks/session-replay/bubble.tsx new file mode 100644 index 0000000000000..6351f47914401 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/session-replay/bubble.tsx @@ -0,0 +1,11 @@ +import { SDKInstallBubbleInstructions } from '../sdk-install-instructions' +import { SessionReplayFinalSteps } from '../shared-snippets' + +export function BubbleInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/session-replay/framer.tsx b/frontend/src/scenes/onboarding/sdks/session-replay/framer.tsx new file mode 100644 index 0000000000000..cf242fc975ed0 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/session-replay/framer.tsx @@ -0,0 +1,11 @@ +import { SDKInstallFramerInstructions } from '../sdk-install-instructions' +import { SessionReplayFinalSteps } from '../shared-snippets' + +export function FramerInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/session-replay/index.tsx b/frontend/src/scenes/onboarding/sdks/session-replay/index.tsx index 1ef01349747b4..f0e1dee69a6ec 100644 --- a/frontend/src/scenes/onboarding/sdks/session-replay/index.tsx +++ b/frontend/src/scenes/onboarding/sdks/session-replay/index.tsx @@ -1,5 +1,14 @@ export * from './android' +export * from './angular' +export * from './astro' +export * from './bubble' +export * from './framer' export * from './html-snippet' export * from './js-web' export * from './next-js' +export * from './nuxt' export * from './react' +export * from './remix' +export * from './svelte' +export * from './vue' +export * from './webflow' diff --git a/frontend/src/scenes/onboarding/sdks/session-replay/nuxt.tsx b/frontend/src/scenes/onboarding/sdks/session-replay/nuxt.tsx new file mode 100644 index 0000000000000..0be9db5e22aa9 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/session-replay/nuxt.tsx @@ -0,0 +1,11 @@ +import { SDKInstallNuxtJSInstructions } from '../sdk-install-instructions/nuxt' +import { SessionReplayFinalSteps } from '../shared-snippets' + +export function NuxtJSInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/session-replay/remix.tsx b/frontend/src/scenes/onboarding/sdks/session-replay/remix.tsx new file mode 100644 index 0000000000000..b8d2c95f21358 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/session-replay/remix.tsx @@ -0,0 +1,11 @@ +import { SDKInstallRemixJSInstructions } from '../sdk-install-instructions/remix' +import { SessionReplayFinalSteps } from '../shared-snippets' + +export function RemixInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/session-replay/svelte.tsx b/frontend/src/scenes/onboarding/sdks/session-replay/svelte.tsx new file mode 100644 index 0000000000000..5908939d2ba18 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/session-replay/svelte.tsx @@ -0,0 +1,11 @@ +import { SDKInstallSvelteJSInstructions } from '../sdk-install-instructions/svelte' +import { SessionReplayFinalSteps } from '../shared-snippets' + +export function SvelteInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/session-replay/vue.tsx b/frontend/src/scenes/onboarding/sdks/session-replay/vue.tsx new file mode 100644 index 0000000000000..3e783a11ba9fb --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/session-replay/vue.tsx @@ -0,0 +1,11 @@ +import { SDKInstallVueInstructions } from '../sdk-install-instructions' +import { SessionReplayFinalSteps } from '../shared-snippets' + +export function VueInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/session-replay/webflow.tsx b/frontend/src/scenes/onboarding/sdks/session-replay/webflow.tsx new file mode 100644 index 0000000000000..081182e59adf3 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/session-replay/webflow.tsx @@ -0,0 +1,11 @@ +import { SDKInstallWebflowInstructions } from '../sdk-install-instructions' +import { SessionReplayFinalSteps } from '../shared-snippets' + +export function WebflowInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/surveys/SurveysSDKInstructions.tsx b/frontend/src/scenes/onboarding/sdks/surveys/SurveysSDKInstructions.tsx index 9e2f7f59ae433..c0ee501fc6fe7 100644 --- a/frontend/src/scenes/onboarding/sdks/surveys/SurveysSDKInstructions.tsx +++ b/frontend/src/scenes/onboarding/sdks/surveys/SurveysSDKInstructions.tsx @@ -1,10 +1,33 @@ import { SDKInstructionsMap, SDKKey } from '~/types' -import { HTMLSnippetInstructions, JSWebInstructions, NextJSInstructions, ReactInstructions } from '.' +import { + AngularInstructions, + AstroInstructions, + BubbleInstructions, + FramerInstructions, + HTMLSnippetInstructions, + JSWebInstructions, + NextJSInstructions, + NuxtJSInstructions, + ReactInstructions, + RemixInstructions, + SvelteInstructions, + VueInstructions, + WebflowInstructions, +} from '.' export const SurveysSDKInstructions: SDKInstructionsMap = { [SDKKey.JS_WEB]: JSWebInstructions, [SDKKey.HTML_SNIPPET]: HTMLSnippetInstructions, + [SDKKey.ANGULAR]: AngularInstructions, + [SDKKey.ASTRO]: AstroInstructions, + [SDKKey.BUBBLE]: BubbleInstructions, + [SDKKey.FRAMER]: FramerInstructions, [SDKKey.NEXT_JS]: NextJSInstructions, + [SDKKey.NUXT_JS]: NuxtJSInstructions, [SDKKey.REACT]: ReactInstructions, + [SDKKey.REMIX]: RemixInstructions, + [SDKKey.SVELTE]: SvelteInstructions, + [SDKKey.VUE_JS]: VueInstructions, + [SDKKey.WEBFLOW]: WebflowInstructions, } diff --git a/frontend/src/scenes/onboarding/sdks/surveys/angular.tsx b/frontend/src/scenes/onboarding/sdks/surveys/angular.tsx new file mode 100644 index 0000000000000..6cc1f3ce7e173 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/surveys/angular.tsx @@ -0,0 +1,9 @@ +import { SDKInstallAngularInstructions } from '../sdk-install-instructions/angular' + +export function AngularInstructions(): JSX.Element { + return ( + <> + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/surveys/astro.tsx b/frontend/src/scenes/onboarding/sdks/surveys/astro.tsx new file mode 100644 index 0000000000000..7984a762ee433 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/surveys/astro.tsx @@ -0,0 +1,9 @@ +import { SDKInstallAstroInstructions } from '../sdk-install-instructions/astro' + +export function AstroInstructions(): JSX.Element { + return ( + <> + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/surveys/bubble.tsx b/frontend/src/scenes/onboarding/sdks/surveys/bubble.tsx new file mode 100644 index 0000000000000..1fcc159344c6b --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/surveys/bubble.tsx @@ -0,0 +1,9 @@ +import { SDKInstallBubbleInstructions } from '../sdk-install-instructions/bubble' + +export function BubbleInstructions(): JSX.Element { + return ( + <> + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/surveys/framer.tsx b/frontend/src/scenes/onboarding/sdks/surveys/framer.tsx new file mode 100644 index 0000000000000..90acbfc4773ae --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/surveys/framer.tsx @@ -0,0 +1,9 @@ +import { SDKInstallFramerInstructions } from '../sdk-install-instructions/framer' + +export function FramerInstructions(): JSX.Element { + return ( + <> + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/surveys/index.tsx b/frontend/src/scenes/onboarding/sdks/surveys/index.tsx index bee13a5ce58bb..a1fbaef355a9c 100644 --- a/frontend/src/scenes/onboarding/sdks/surveys/index.tsx +++ b/frontend/src/scenes/onboarding/sdks/surveys/index.tsx @@ -1,4 +1,13 @@ +export * from './angular' +export * from './astro' +export * from './bubble' +export * from './framer' export * from './html-snippet' export * from './js-web' export * from './next-js' +export * from './nuxt' export * from './react' +export * from './remix' +export * from './svelte' +export * from './vue' +export * from './webflow' diff --git a/frontend/src/scenes/onboarding/sdks/surveys/nuxt.tsx b/frontend/src/scenes/onboarding/sdks/surveys/nuxt.tsx new file mode 100644 index 0000000000000..ceddb9c49744d --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/surveys/nuxt.tsx @@ -0,0 +1,9 @@ +import { SDKInstallNuxtJSInstructions } from '../sdk-install-instructions/nuxt' + +export function NuxtJSInstructions(): JSX.Element { + return ( + <> + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/surveys/remix.tsx b/frontend/src/scenes/onboarding/sdks/surveys/remix.tsx new file mode 100644 index 0000000000000..1a6f96abae481 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/surveys/remix.tsx @@ -0,0 +1,9 @@ +import { SDKInstallRemixJSInstructions } from '../sdk-install-instructions/remix' + +export function RemixInstructions(): JSX.Element { + return ( + <> + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/surveys/svelte.tsx b/frontend/src/scenes/onboarding/sdks/surveys/svelte.tsx new file mode 100644 index 0000000000000..3faf6bbbd394f --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/surveys/svelte.tsx @@ -0,0 +1,9 @@ +import { SDKInstallSvelteJSInstructions } from '../sdk-install-instructions/svelte' + +export function SvelteInstructions(): JSX.Element { + return ( + <> + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/surveys/vue.tsx b/frontend/src/scenes/onboarding/sdks/surveys/vue.tsx new file mode 100644 index 0000000000000..1714535074989 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/surveys/vue.tsx @@ -0,0 +1,9 @@ +import { SDKInstallVueInstructions } from '../sdk-install-instructions/vue' + +export function VueInstructions(): JSX.Element { + return ( + <> + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/surveys/webflow.tsx b/frontend/src/scenes/onboarding/sdks/surveys/webflow.tsx new file mode 100644 index 0000000000000..d7431d7b7d307 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/surveys/webflow.tsx @@ -0,0 +1,9 @@ +import { SDKInstallWebflowInstructions } from '../sdk-install-instructions/webflow' + +export function WebflowInstructions(): JSX.Element { + return ( + <> + + + ) +} diff --git a/frontend/src/types.ts b/frontend/src/types.ts index f24dbec6a7eae..56708d5ae1d85 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -3743,34 +3743,43 @@ export type SDK = { } export enum SDKKey { - JS_WEB = 'javascript_web', - REACT = 'react', - NEXT_JS = 'nextjs', - GATSBY = 'gatsby', - IOS = 'ios', ANDROID = 'android', + ANGULAR = 'angular', + ASTRO = 'astro', + API = 'api', + BUBBLE = 'bubble', + DJANGO = 'django', + DOCUSAURUS = 'docusaurus', + ELIXIR = 'elixir', + FRAMER = 'framer', FLUTTER = 'flutter', - REACT_NATIVE = 'react_native', - NODE_JS = 'nodejs', - RUBY = 'ruby', - PYTHON = 'python', - PHP = 'php', + GATSBY = 'gatsby', GO = 'go', - ELIXIR = 'elixir', - API = 'api', - JAVA = 'java', - RUST = 'rust', GOOGLE_TAG_MANAGER = 'google_tag_manager', + HTML_SNIPPET = 'html', + IOS = 'ios', + JAVA = 'java', + JS_WEB = 'javascript_web', + LARAVEL = 'laravel', + NEXT_JS = 'nextjs', + NODE_JS = 'nodejs', NUXT_JS = 'nuxtjs', - VUE_JS = 'vuejs', - SEGMENT = 'segment', + PHP = 'php', + PYTHON = 'python', + REACT = 'react', + REACT_NATIVE = 'react_native', + REMIX = 'remix', + RETOOL = 'retool', + RUBY = 'ruby', RUDDERSTACK = 'rudderstack', - DOCUSAURUS = 'docusaurus', + RUST = 'rust', + SEGMENT = 'segment', + SENTRY = 'sentry', SHOPIFY = 'shopify', + SVELTE = 'svelte', + VUE_JS = 'vuejs', + WEBFLOW = 'webflow', WORDPRESS = 'wordpress', - SENTRY = 'sentry', - RETOOL = 'retool', - HTML_SNIPPET = 'html', } export enum SDKTag {