:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { ComponentType, useState } from 'react'
import * as einsteinPng from '@posthog/brand/hoggies/png/einstein'
import * as magnifyingGlassPng from '@posthog/brand/hoggies/png/magnifying-glass'
import * as reporterPng from '@posthog/brand/hoggies/png/reporter'
import * as starPng from '@posthog/brand/hoggies/png/star'
import { pngHoggie } from 'lib/brand/hoggies'
import { WizardStep } from './surveyWizardLogic'
const HedgehogEinstein = pngHoggie(einsteinPng)
const HedgehogMagnifyingGlass = pngHoggie(magnifyingGlassPng)
const HedgehogReporter = pngHoggie(reporterPng)
const HedgehogStar = pngHoggie(starPng)
interface Tip {
text: string
Hog: ComponentType<{ className?: string }>
}
// Tips focused on increasing survey completion rates
const TIPS_BY_STEP: Record<WizardStep, Tip[]> = {
template: [
{
text: 'NPS is best for measuring overall loyalty. Use it quarterly for meaningful trends.',
Hog: HedgehogStar,
},
{
text: 'CSAT works great after specific interactions — support, purchase, feature use.',
Hog: HedgehogEinstein,
},
{
text: 'PMF surveys help identify your most valuable users and understand your market fit.',
Hog: HedgehogMagnifyingGlass,
},
],
questions: [
{
text: 'Shorter surveys get more completions. Every extra question is a chance for someone to drop off.',
Hog: HedgehogEinstein,
},
{ text: 'Lead with your most important question — some users only answer the first one.', Hog: HedgehogStar },
{
text: 'Rating scales are easier to answer than open text. Save open-ended questions for the end.',
Hog: HedgehogReporter,
},
{
text: 'Make your first question dead simple. Save harder questions for engaged respondents.',
Hog: HedgehogEinstein,
},
{ text: 'Be specific: "How was checkout?" beats "How was your experience?"', Hog: HedgehogStar },
{ text: 'Every field is friction. Only ask what you truly need to know.', Hog: HedgehogMagnifyingGlass },
],
where: [
{ text: 'Surveys work best after someone takes an action — signup, purchase, feature use.', Hog: HedgehogStar },
{
text: "Landing pages are usually too early. Users haven't formed opinions yet.",
Hog: HedgehogMagnifyingGlass,
},
{ text: 'Returning visitors are more likely to respond than first-time visitors.', Hog: HedgehogEinstein },
{
text: 'Exit-intent surveys on pricing pages can capture valuable "why not buy" feedback.',
Hog: HedgehogMagnifyingGlass,
},
{
text: 'Show NPS surveys after users have experienced value, not immediately after signup.',
Hog: HedgehogStar,
},
{
text: 'Dashboard and settings pages catch users who are already engaged with your product.',
Hog: HedgehogReporter,
},
],
when: [
{
text: 'Give users a moment to orient before showing a survey. Immediate popups get dismissed reflexively.',
Hog: HedgehogEinstein,
},
{
text: 'Trigger after success moments — completed tasks, achieved goals, resolved issues.',
Hog: HedgehogStar,
},
{
text: 'Avoid interrupting active workflows. Survey during natural pauses instead.',
Hog: HedgehogMagnifyingGlass,
},
{
text: 'Event-based triggers tend to catch users at better moments than time-based ones.',
Hog: HedgehogReporter,
},
{
text: 'Good trigger moments: after purchase, finishing onboarding, or resolving a support ticket.',
Hog: HedgehogStar,
},
{
text: "Don't survey the same person too often. Quality drops when users feel over-surveyed.",
Hog: HedgehogEinstein,
},
],
appearance: [
{
text: 'Match your brand colors for a cohesive experience. Surveys that look native get more responses.',
Hog: HedgehogStar,
},
{
text: 'Dark themes work great for developer tools and evening products. Light themes feel friendlier.',
Hog: HedgehogEinstein,
},
{
text: 'High contrast between buttons and background makes the next action obvious.',
Hog: HedgehogMagnifyingGlass,
},
],
success: [],
}
interface MaxTipProps {
step: WizardStep
}
export function MaxTip({ step }: MaxTipProps): JSX.Element | null {
const tips = TIPS_BY_STEP[step]
// Pick a random tip index once when the component mounts for this step
const [tipIndices] = useState<Record<string, number>>(() => ({
template: Math.floor(Math.random() * TIPS_BY_STEP.template.length),
questions: Math.floor(Math.random() * TIPS_BY_STEP.questions.length),
where: Math.floor(Math.random() * TIPS_BY_STEP.where.length),
when: Math.floor(Math.random() * TIPS_BY_STEP.when.length),
appearance: Math.floor(Math.random() * TIPS_BY_STEP.appearance.length),
}))
const selectedTip = tips?.[tipIndices[step]] ?? null
if (!selectedTip) {
return null
}
const { text, Hog } = selectedTip
return (
<div className="flex items-center justify-center gap-3 mt-10 pt-6 border-t border-border">
<div className="flex-shrink-0 opacity-80">
<Hog className="w-10 h-10" />
</div>
<span className="text-xs text-muted">{text}</span>
</div>
)
}