: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
from django.db import models
from products.customer_analytics.backend.facade.enums import CustomPropertyOptionColor
DEFAULT_ACTIVITY_EVENT = {"kind": "EventsNode", "event": "$pageview", "name": "$pageview"}
# Mirrors frontend `SLACK_ARCHIVES_ORIGIN` in accountLinksLogic.ts. PostHog-internal: hardcodes our
# own workspace, so Slack links are wrong for any other team. Replace with the per-team workspace
# URL (from the conversations bot's auth.test) before GA — see COMPROMISES.md.
SLACK_ARCHIVES_ORIGIN = "https://posthog.slack.com/archives"
# Mirrors frontend `FEATURE_FLAGS.CUSTOMER_ANALYTICS_CSP`.
CUSTOMER_ANALYTICS_CSP_FLAG = "customer-analytics-csp"
CUSTOMER_ANALYTICS_FEATURE_REQUESTS_FLAG = "customer-analytics-feature-requests"
CUSTOMER_ANALYTICS_TRACK_RULES_FLAG = "customer-analytics-track-rules"
CUSTOMER_ANALYTICS_CUSTOMER_TASKS_FLAG = "customer-analytics-customer-tasks"
CUSTOMER_ANALYTICS_ACCOUNT_VIEWS_FLAG = "customer-analytics-account-views"
# Mirrors frontend `FEATURE_FLAGS.WAREHOUSE_PERSON_PROPERTIES`. Gates the whole warehouse -> person
# properties feature: creating person-target custom property sources (API + UI), staging rows during
# syncs, and the post-sync upsert workflow.
WAREHOUSE_PERSON_PROPERTIES_FLAG = "warehouse-person-properties"
# Mirrors frontend `BILLING_INSIGHT_SHORT_IDS` in accountBillingLogic.ts. These saved insights read
# warehouse-synced billing data to report an account's PostHog consumption (events ingested, rows
# synced, recordings, etc.) and spend (MRR, per-product cost). PostHog-internal: they only resolve
# in environments where the billing warehouse data exists; elsewhere the agent's lookup falls back.
BILLING_USAGE_INSIGHT_SHORT_IDS = ["fiJDsKLp"]
BILLING_SPEND_INSIGHT_SHORT_IDS = ["o4I9sdFE", "Tjo4bsux"]
class CustomPropertyDisplayType(models.TextChoices):
TEXT = "text", "text"
LINK = "link", "link"
NUMBER = "number", "number"
CURRENCY = "currency", "currency"
PERCENT = "percent", "percent"
DATE = "date", "date"
DATETIME = "datetime", "datetime"
BOOLEAN = "boolean", "boolean"
SELECT = "select", "select"
CUSTOM_PROPERTY_DISPLAY_TYPE_CHOICES = list(CustomPropertyDisplayType.values)
CUSTOM_PROPERTY_OPTION_COLORS = CustomPropertyOptionColor.values
# Bounds the fan-out so one create can't enqueue an unbounded Slack send loop.
MAX_ANNOUNCEMENT_CHANNELS = 200
# Base URL for constructed Slack message permalinks (<origin>/<channel_id>/p<ts>) in account
# channel summaries. Hardcodes PostHog's workspace — pre-GA compromise, see COMPROMISES.md.
# Mirrors the frontend's SLACK_ARCHIVES_ORIGIN in accountLinksLogic.ts.
SLACK_ARCHIVES_ORIGIN = "https://posthog.slack.com/archives"
# Mirrors models.SlackSummaryCadence — kept as a plain list so the presentation layer's
# ChoiceFields stay off the model import path.
SLACK_SUMMARY_CADENCE_CHOICES = ["daily", "weekly", "monthly"]
DELIVERY_IN_FLIGHT_ERROR = "in_flight"
DELIVERY_RATE_LIMIT_DEFERRED_ERROR = "rate_limited_deferred"
DELIVERY_INTERRUPTED_ERROR = "interrupted before confirmation; the message may have been delivered"
# Marks an async query status whose stored results are account users, so retrieval repeats the access check.
ACCOUNT_USERS_QUERY_STATUS_LABEL_PREFIX = "customer-analytics-account-users:"