: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
// The page state the content script would send to the side panel, one per screenshot. It matches what each site capture shows.
const PAGE_URL = 'https://www.example.com/'
const base = {
mode: 'none',
inspect: { element: null, isSelected: false },
selectorCounts: {},
heatmap: {
wildcardHref: PAGE_URL,
autoWildcardEnabled: false,
wildcardHrefTooSpecific: false,
wildcardHrefEndsWithSlash: true,
commonFilters: { date_from: '-7d' },
heatmapFilters: { enabled: true, type: 'click', viewportAccuracy: 0.9, aggregation: 'total_count' },
heatmapColorPalette: 'default',
heatmapFixedPositionMode: 'fixed',
viewportRange: { min: 1152, max: 1408 },
rawHeatmapLoading: false,
heatmapsCollection: 'enabled',
scrollDepthPosthogJsError: null,
clickmapsEnabled: true,
clickmapLoading: false,
processingProgress: null,
matchLinksByHref: true,
countedElements: [
{ text: 'Start free trial', tagName: 'a', count: 1280 },
{ text: 'Book a demo', tagName: 'a', count: 613 },
{ text: 'Pricing', tagName: 'a', count: 402 },
{ text: 'Features', tagName: 'a', count: 188 },
{ text: 'Log in', tagName: 'a', count: 96 },
],
clickCount: 2579,
canLoadMoreElementStats: false,
loadedElementStatsCount: 5,
loadingAllElementStats: false,
areaSelectionActive: false,
areaFilter: null,
savingHeatmap: false,
saveProgress: null,
saveResult: null,
},
actions: {
allActionsLoading: false,
actions: [
{ id: 1, name: 'Started a free trial' },
{ id: 2, name: 'Booked a demo' },
{ id: 3, name: 'Viewed pricing' },
],
selectedActionId: null,
actionForm: { name: null, steps: [{}] },
formRevision: 0,
actionFormElementsChains: {},
inspectingElement: null,
saving: false,
saveResult: null,
},
flags: {
available: true,
loading: false,
flags: [
{
key: 'launch-banner',
id: 11,
value: false,
currentValue: true,
hasOverride: true,
variants: [],
payloadOverride: { message: 'Trailmark 2.0: plan a sprint from a template' },
},
{
key: 'hero-copy',
id: 12,
value: 'control',
currentValue: 'bold',
hasOverride: true,
variants: [
{ key: 'control', name: 'Current copy', rolloutPercentage: 50 },
{ key: 'bold', name: 'Shorter headline', rolloutPercentage: 50 },
],
payloadOverride: undefined,
},
{
key: 'new-onboarding',
id: 13,
value: true,
currentValue: true,
hasOverride: false,
variants: [],
payloadOverride: undefined,
},
{
key: 'pricing-layout',
id: 14,
value: false,
currentValue: false,
hasOverride: false,
variants: [],
payloadOverride: undefined,
},
],
countFlagsOverridden: 2,
impersonatedDistinctId: null,
payloadErrors: {},
mutationPending: false,
mutationError: null,
mutationRevision: 0,
},
events: {
available: true,
selectedEventTypes: ['posthog', 'custom'],
hidePostHogProperties: false,
hidePostHogFlags: false,
relativeTimestamps: false,
isPaused: false,
bufferedCount: 0,
totalCount: 4,
filteredCount: 4,
countsByType: { posthog: 2, custom: 2, snapshot: 0 },
rows: [
{ uuid: 'e4', event: 'demo_booked', timestamp: '2026-01-15T17:30:27.528Z', pinned: false },
{ uuid: 'e3', event: 'plan_selected', timestamp: '2026-01-15T17:30:21.114Z', pinned: false },
{ uuid: 'e2', event: '$autocapture', timestamp: '2026-01-15T17:30:20.902Z', pinned: false },
{ uuid: 'e1', event: '$pageview', timestamp: '2026-01-15T17:30:02.311Z', pinned: false },
],
expandedEventId: 'e3',
expandedProperties: {
$active_feature_flags: ['new-onboarding'],
$browser: 'Chrome',
$current_url: PAGE_URL,
distinct_id: '0192f0e4-visitor-example',
'$feature/new-onboarding': true,
$lib: 'web',
$os: 'Mac OS X',
$pathname: '/',
billing: 'monthly',
plan: 'team',
seats: 6,
},
expandedEventPayload: { event: 'plan_selected', properties: { plan: 'team', seats: 6, billing: 'monthly' } },
},
webVitals: {
autocaptureEnabled: true,
pathname: '/',
localWebVitals: { FCP: 812, LCP: 1640, INP: 96, CLS: 0.04 },
remoteWebVitals: { FCP: 1210, LCP: 2380, INP: 180, CLS: 0.08 },
},
experiments: {
loading: false,
experiments: [
{ id: 21, name: 'Shorter hero headline' },
{ id: 22, name: 'Demo button copy' },
],
webExperimentsDisabled: false,
selectedExperimentId: null,
experimentForm: { name: '', variants: {} },
formRevision: 0,
selectedVariant: '',
selectedElementType: 'all-elements',
inspectingElement: null,
addVariantAvailable: true,
removeVariantAvailable: false,
saving: false,
saveResult: null,
},
more: {
debugInfo: {
version: '1.300.0',
apiHost: 'https://us.i.posthog.com',
uiHost: null,
autocapture: true,
rageclicks: true,
deadClicks: true,
heatmaps: true,
sessionRecordingStarted: true,
sessionRecordingStatus: 'active',
sessionReplayUrl: 'https://us.posthog.com/project/1/replay/session-1',
surveysCount: 2,
},
debugInfoLoading: false,
piiMaskingEnabled: false,
piiMaskingColor: '#cccccc',
piiWarnings: [],
screenshot: {
taking: false,
open: false,
eventName: '',
suggestions: [],
suggestionsLoading: false,
selectedEventId: null,
uploading: false,
result: null,
},
},
}
export const PANEL_STATES = {
heatmap: { ...base, mode: 'heatmap' },
inspect: {
...base,
mode: 'inspect',
inspect: {
isSelected: true,
element: {
tagName: 'a',
actionStep: {
event: '$autocapture',
tag_name: 'a',
text: 'Start free trial',
selector: '[data-attr="hero-signup"]',
href: '/signup',
url: PAGE_URL,
},
stats: { count: 1312, clickCount: 1280, rageclickCount: 14, deadclickCount: 6, rank: 1 },
actions: [{ id: 1, name: 'Started a free trial' }],
},
},
},
flags: { ...base, mode: 'flags' },
events: { ...base, mode: 'events' },
}