Skip to content

Commit

Permalink
feat: add next-js to product analytics onboarding docs (#20239)
Browse files Browse the repository at this point in the history
* add next to product analytics docs

* fix spelling
  • Loading branch information
raquelmsmith authored Feb 16, 2024
1 parent 7ae44b8 commit 6c32341
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { CodeSnippet, Language } from 'lib/components/CodeSnippet'

function JSEventSnippet(): JSX.Element {
return (
<CodeSnippet language={Language.JavaScript}>{`posthog.capture('my event', { property: 'value' })`}</CodeSnippet>
)
}

export const ProductAnalyticsAllJSFinalSteps = (): JSX.Element => {
return (
<>
<h4>Send events</h4>
<p>
Click around and view a couple pages to generate some events. Our package automatically captures them
for you.
</p>
<h4>Optional: Send a manual event</h4>
<p>If you'd like, you can manually define events, too.</p>
<JSEventSnippet />
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
ProductAnalyticsFlutterInstructions,
ProductAnalyticsGoInstructions,
ProductAnalyticsIOSInstructions,
ProductAnalyticsNextJSInstructions,
ProductAnalyticsNodeInstructions,
ProductAnalyticsPHPInstructions,
ProductAnalyticsPythonInstructions,
Expand All @@ -19,7 +20,8 @@ import {
export const ProductAnalyticsSDKInstructions: SDKInstructionsMap = {
[SDKKey.JS_WEB]: JSWebInstructions,
[SDKKey.HTML_SNIPPET]: HTMLSnippetInstructions,
// add next, getsby, and others here
[SDKKey.NEXT_JS]: ProductAnalyticsNextJSInstructions,
// add getsby and other frameworks here
[SDKKey.IOS]: ProductAnalyticsIOSInstructions,
[SDKKey.REACT_NATIVE]: ProductAnalyticsRNInstructions,
[SDKKey.ANDROID]: ProductAnalyticsAndroidInstructions,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
import { LemonDivider } from '@posthog/lemon-ui'
import { CodeSnippet, Language } from 'lib/components/CodeSnippet'

import { SDKHtmlSnippetInstructions } from '../sdk-install-instructions/html-snippet'

function JSEventSnippet(): JSX.Element {
return (
<CodeSnippet language={Language.JavaScript}>{`posthog.capture('my event', { property: 'value' })`}</CodeSnippet>
)
}
import { ProductAnalyticsAllJSFinalSteps } from './AllJSFinalSteps'

export function HTMLSnippetInstructions(): JSX.Element {
return (
<>
<SDKHtmlSnippetInstructions />
<LemonDivider thick dashed className="my-4" />
<h4>Optional: Send a manual event</h4>
<p>Our snippet will autocapture events for you, but you can manually define events, too!</p>
<JSEventSnippet />
<ProductAnalyticsAllJSFinalSteps />
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export * from './go'
export * from './html-snippet'
export * from './ios'
export * from './js-web'
export * from './next-js'
export * from './nodejs'
export * from './php'
export * from './python'
Expand Down
12 changes: 2 additions & 10 deletions frontend/src/scenes/onboarding/sdks/product-analytics/js-web.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
import { LemonDivider } from '@posthog/lemon-ui'
import { CodeSnippet, Language } from 'lib/components/CodeSnippet'

import { SDKInstallJSWebInstructions } from '../sdk-install-instructions'

function JSEventSnippet(): JSX.Element {
return (
<CodeSnippet language={Language.JavaScript}>{`posthog.capture('my event', { property: 'value' })`}</CodeSnippet>
)
}
import { ProductAnalyticsAllJSFinalSteps } from './AllJSFinalSteps'

export function JSWebInstructions(): JSX.Element {
return (
<>
<SDKInstallJSWebInstructions />
<LemonDivider thick dashed className="my-4" />
<h4>Optional: Send a manual event</h4>
<p>Our package will autocapture events for you, but you can manually define events, too!</p>
<JSEventSnippet />
<ProductAnalyticsAllJSFinalSteps />
</>
)
}
14 changes: 14 additions & 0 deletions frontend/src/scenes/onboarding/sdks/product-analytics/next-js.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { LemonDivider } from '@posthog/lemon-ui'

import { SDKInstallNextJSInstructions } from '../sdk-install-instructions/next-js'
import { ProductAnalyticsAllJSFinalSteps } from './AllJSFinalSteps'

export function ProductAnalyticsNextJSInstructions(): JSX.Element {
return (
<>
<SDKInstallNextJSInstructions />
<LemonDivider thick dashed className="my-4" />
<ProductAnalyticsAllJSFinalSteps />
</>
)
}

0 comments on commit 6c32341

Please sign in to comment.