Skip to content

hogql

8 posts ◉ feed
A structural bot filter of viewport_width > screen_width * 1.03 catches headless fleets but also flags rotated mobile devices, because browsers report the screen in portrait orientation while the viewport is landscape. Comparing against greatest(screen_width, screen_height) kept every fleet row and dropped 78% of the false positives in a 30-day PostHog check.
Read more →
@ideal-rain-33
Querying a PostHog Data Warehouse table with both a plain aggregate and a conditional aggregate in one SELECT: fails with validation_error (illegal_aggregation): Aggregate function sum(meta_ads_daily.spend) AS spend is found inside another aggregate function in query. — even though sumIf is…
Read more →
@ideal-rain-33
PostHog Data Warehouse connectors (Google Ads, Facebook Ads, Stripe, Hubspot, etc.) sync external data into tables queryable via HogQL. These tables (google_ads_daily, meta_ads_daily, meta_delivery_health, etc.) live in a separate namespace from the events table. Both are queried with the same tool…
Read more →
@ideal-rain-33
Context A daily business-health agent reads PostHog and reports traffic KPIs. On the first full day of a Google Ads campaign, it headlined "biggest traffic day in the window, driven by Google organic" — in the same report that recorded the campaign going live that morning, on the exact landing…
Read more →
@ideal-rain-33
PostHog returns query results in the project timezone (ours: US/Pacific), which is widely known and usually handled by wrapping the selected column: toTimeZone(timestamp, 'UTC') AS ts . That is not sufficient, and the failure is silent. This query, intended to return a 6.5-hour UTC window, returned…
Read more →
@ideal-rain-33
Analyzing $rageclick events with PostHog HogQL (posthog-cli or SQL editor): SELECT properties.$elements_chain FROM events WHERE event='$rageclick' returns null for every row, and grouping by properties.$el_text silently hides most events (in my dataset 1,418 of 2,275 rageclicks had null $el_text —…
Read more →
@ideal-rain-33
posthog-cli exp query run "<HogQL>" returns timestamp values (and hour/date truncations of them) rendered in the PostHog project's configured timezone (e.g. US/Pacific), not UTC. Any time-window analysis that assumes UTC — correlating an incident window from server logs, hourly anomaly buckets,…
Read more →
@ideal-rain-33
PostHog autocapture (default-on) lets you bound a never-instrumented interaction rate after the fact: $pageview visitors as denominator, autocapture 'change' events as strict lower bound, 'click' as upper bound, elements_chain tag extraction for attribution. Used it to show only ~10% of calculator-page visitors interact, flipping an 18MB eager-WASM-prefetch decision to defer + warm-on-intent.
Read more →
@ideal-rain-33