mirror of
https://github.com/hanzoai/insights.git
synced 2026-10-30 16:15:31 +00:00
The rule table mapped HOG_ -> FN_ ahead of any POSTHOG rule, so POSTHOG_FOO split into POST + HOG_ and came out POSTFN_FOO. Nothing sets that. The live pods set INSIGHTS_SKIP_MIGRATION_CHECKS, which bin/migrate-check reads on the container entrypoint, so the misspelling does not degrade a feature -- it runs migrate --check against a database whose history this tree does not share and the container never starts. Both replacements are measured against the shipped tree rather than chosen: every HOG_ name with a counterpart there is spelled INSIGHTS_ (HOG_QL -> INSIGHTS_QL, HOG_FUNCTION_TEMPLATES -> INSIGHTS_FUNCTION_TEMPLATES, 12 of 12 determinate cases), and FN_ appears in it nowhere. Upstream carries 95 HOG_ tokens and zero FN_ ones, so repairing FN_ back out is exactly the inverse of the bad rule and cannot collide with an upstream name. The rule is fixed for the next convergence, and the tree it already produced is repaired in the same commit -- the codemod is idempotent against its own output, so it cannot undo this itself.
104 lines
4.0 KiB
TypeScript
104 lines
4.0 KiB
TypeScript
import { OnboardingComponentsContext, createInstallation } from 'scenes/onboarding/shared/OnboardingDocsContentWrapper'
|
|
|
|
import { StepDefinition } from '../steps'
|
|
|
|
export const getAndroidSteps = (ctx: OnboardingComponentsContext): StepDefinition[] => {
|
|
const { CodeBlock, Markdown, dedent } = ctx
|
|
|
|
return [
|
|
{
|
|
title: 'Install the dependency',
|
|
badge: 'required',
|
|
content: (
|
|
<>
|
|
<Markdown>Add the Insights Android SDK to your `build.gradle` dependencies:</Markdown>
|
|
<CodeBlock
|
|
blocks={[
|
|
{
|
|
language: 'kotlin',
|
|
file: 'build.gradle',
|
|
code: dedent`
|
|
dependencies {
|
|
implementation("com.insights:insights-android:3.+")
|
|
}
|
|
`,
|
|
},
|
|
]}
|
|
/>
|
|
</>
|
|
),
|
|
},
|
|
{
|
|
title: 'Configure Insights',
|
|
badge: 'required',
|
|
content: (
|
|
<>
|
|
<Markdown>Initialize Insights in your Application class:</Markdown>
|
|
<CodeBlock
|
|
blocks={[
|
|
{
|
|
language: 'kotlin',
|
|
file: 'SampleApp.kt',
|
|
code: dedent`
|
|
class SampleApp : Application() {
|
|
|
|
companion object {
|
|
const val INSIGHTS_PROJECT_TOKEN = "<ph_project_token>"
|
|
const val INSIGHTS_HOST = "<ph_client_api_host>"
|
|
}
|
|
|
|
override fun onCreate() {
|
|
super.onCreate()
|
|
|
|
// Create a Insights Config with the given project token and host
|
|
val config = InsightsAndroidConfig(
|
|
apiKey = INSIGHTS_PROJECT_TOKEN,
|
|
host = INSIGHTS_HOST
|
|
)
|
|
|
|
// Setup Insights with the given Context and Config
|
|
InsightsAndroid.setup(this, config)
|
|
}
|
|
}
|
|
`,
|
|
},
|
|
]}
|
|
/>
|
|
</>
|
|
),
|
|
},
|
|
{
|
|
title: 'Send events',
|
|
badge: 'recommended',
|
|
content: (
|
|
<>
|
|
<Markdown>
|
|
Once installed, Insights will automatically start capturing events. You can also manually send
|
|
events to test your integration:
|
|
</Markdown>
|
|
<CodeBlock
|
|
blocks={[
|
|
{
|
|
language: 'kotlin',
|
|
file: 'Kotlin',
|
|
code: dedent`
|
|
import com.insights.Insights
|
|
|
|
Insights.capture(
|
|
event = "button_clicked",
|
|
properties = mapOf(
|
|
"button_name" to "signup"
|
|
)
|
|
)
|
|
`,
|
|
},
|
|
]}
|
|
/>
|
|
</>
|
|
),
|
|
},
|
|
]
|
|
}
|
|
|
|
export const AndroidInstallation = createInstallation(getAndroidSteps)
|