Analytics & Success Metrics

This note records the analytics setup that is currently in the application and how it maps to the Google/CDP handoff notes.

The source handoff documents identify two measurement surfaces:

  • Looker Studio / GA4 / BigQuery for general usage and “Population Reached via Research”.
  • PostHog for richer product interaction and Ask CDP AI metrics.
DashboardLinkNotes
Looker Studio traffic monitorTraffic monitor dashboardListed near the top of the Google x CDP technical handoff.
Looker Studio dashboardLooker Studio reportListed later in the technical handoff as the Looker dashboard.
GA4 detailed analysisDetailed analysis dashboardLinked from the success-metrics doc for location_viewed reporting.
GA4 reporting hub draftReporting hub dashboardDescribed in the success-metrics doc as an early-preview draft dashboard.
GA4 pages and screens reportPages and screens reportLinked from the GA/Looker work log for page and screen engagement review.
PostHog projectPostHog project 141282Core product analytics project for Adapt Action Explorer.
PostHog AI ObservabilityPostHog AI tracesAsk CDP AI LLM traces. Full input/output content is stored in posthog.ai_events (input, output_choices).
Langfuse tracesLangfuse cdp ask tracesLLM trace dashboard with full input, output, usage, latency, and cost details.
Ask CDP AI weekly statsAsk CDP AI statsMarkdown reports that separate AI-chat opens and real user actions from internal follow-up generation and smoke-test traffic.

Dashboard Access Status

Slack follow-up on 2026-06-24 reported that GA4 dashboard access has been requested and that the other Google/Looker links appear empty from the requester’s view. Treat those dashboards as handoff links that still need access and data-source verification, not as confirmed working reporting surfaces.

2026-06-30 update: direct testing of the GA4 detailed-analysis link returned a missing-permissions response. The required next step is for a Google Analytics administrator or report owner to grant access to the relevant GA4 property, linked Looker Studio reports, and any underlying BigQuery data source.

Next steps:

  1. Confirm which Google account should have access to GA4 property G-Z6QWJ09VM8, the linked Looker Studio reports, and any underlying BigQuery data source.
  2. After access is granted, open each Google/Looker link above and check whether the report is empty because of permissions, date-range filters, disconnected data sources, or genuinely missing events.
  3. Validate that production still emits location_viewed into GA4 by using DebugView or the GA4 event report after opening a location detail page on https://cdp-action-explorer.net/.
  4. If the Looker reports remain empty after permissions and date ranges are confirmed, ask CDP/Google to identify the owner of the GA4-to-BigQuery/Looker pipeline for the “Population Reached via Research” metric.
  5. Use the PostHog links as the immediately actionable product-analytics fallback while the Google/Looker dashboard access is being resolved.

Current Tooling

ToolCurrent roleConfiguration
Google Analytics 4General page and selected custom event tracking.The frontend loads gtag.js for property G-Z6QWJ09VM8 in frontend/src/index.html.
PostHogProduct interaction, user-role, and Ask CDP AI events.Enabled at frontend build time with FRONTEND_POSTHOG_ENABLED=true and FRONTEND_POSTHOG_KEY. The default host is https://eu.i.posthog.com.
Looker Studio / BigQueryReporting layer for GA4-derived dashboard metrics.External to the app repo. The Google handoff describes monthly joins from distinct location_viewed locations to population data.
SentryBrowser exception and performance monitoring.Optional frontend build-time config through FRONTEND_SENTRY_* variables.

Evidence Sources

This page is grounded in the current implementation rather than only the original handoff notes:

SourceWhat it confirms
frontend/src/index.html and frontend/src/app/app.tsGA4 property G-Z6QWJ09VM8 is loaded and configured at app startup.
frontend/src/app/core/analytics/posthog.service.tsPostHog initialization, manual $pageview, exception capture, session recording masking, and stored user_type enrichment.
frontend/src/app/core/analytics/analytics-events.tsShared PostHog property builders for locations, pins, hazards, action items, and solutions.
frontend/src/app/features/**Component-level user interaction events sent to PostHog and GA4.
app/observability.py in cdp-ai-engineAI-server $ai_generation payloads sent to PostHog and Langfuse, including full input/output content when enabled.
.github/workflows/ai-server-deploy.yml in cdp-ai-engineDeploy smoke check verifies PostHog AI content lands in posthog.ai_events.input and posthog.ai_events.output_choices.

Implemented Events

Google Analytics

The Angular app configures GA4 at startup and fires a small set of custom events:

EventTriggerProperties
location_viewedA full location detail profile is loaded.location_id, currently the location name in the GA event payload.
chatbot_query_submitA user submits a manual Ask CDP AI query.No query text is sent to GA.
chatbot_suggest_clickA user clicks an Ask CDP AI follow-up suggestion.query_text is sent to GA by the current implementation.

The Google success-metrics notes say GA should receive location_id for the population-reached dashboard. In the current code, GA uses the display name as location_id; PostHog receives the stable organization id plus location_name.

PostHog

PostHog is disabled unless the frontend build includes a key and enables it. When enabled, the app captures page views manually and captures exceptions through the shared error handler. The wrapper also adds the stored user_type to custom events unless the event already sets one.

Session replay is configured defensively: input values are masked, page text is masked, and elements matching .sensitive-data or [data-ph-no-capture] are blocked. Autocapture is restricted to https://cdp-action-explorer.net, localhost, and 127.0.0.1; the app still sends explicit custom events on Cloud Run preview URLs.

Key custom events include:

AreaEvents
Search and mapsearch_location_selected, map_pin_selected
Location detaillocation_viewed, location_tab_changed
Hazards and actionshazard_detail_expanded, hazard_actions_explore_clicked, action_hazard_filter_applied, action_hazard_filter_cleared
Government actionsgovernment_action_opened, funding_project_opened, adaptation_goal_opened
Action ideassolution_hazard_filter_applied, solution_hazard_filter_cleared, solution_detail_opened
Ask CDP AIai_chat_opened, ai_chat_query_submitted, ai_chat_followup_clicked
Feedback and rolefeedback_opened, user_role_selected

PostHog event properties are built from frontend/src/app/core/analytics/analytics-events.ts. Location events include organization id, location name, country, public status, disclosure year, and counts for hazards/actions/goals/projects when available.

PostHog Event Payloads

EventTriggerCore properties
$pageviewPostHog service init and every Angular NavigationEnd.$current_url, path, search, plus stored user_type when available.
location_viewedA full location profile with hazards loads for a new location.location_id, location_name, country, public_status, disclosure_year, hazards_count, actions_count, goals_count, projects_count.
location_tab_changedUser changes the location detail tab, or hazard exploration switches to actions.Location properties, from_tab, to_tab, optional source.
search_location_selectedUser selects a search result, loads a typed search result, or opens details from a map pin.location_id, location_name, country, source, optional query_length, optional result_rank.
map_pin_selectedUser clicks a map pin.location_name, org_type, zoom_level.
hazard_detail_expandedUser expands a hazard detail card.Location properties, hazard_type, other_hazard_details, hazard_rank, hazard_source.
hazard_actions_explore_clickedUser clicks from a hazard into related actions.Location properties, hazard properties, action_count.
action_hazard_filter_appliedUser applies an actions hazard filter.Location properties, hazard_type, other_hazard_details, matching_action_count.
action_hazard_filter_clearedUser clears the actions hazard filter.Location properties, previously selected hazard_type and other_hazard_details.
government_action_openedUser opens an adaptation action detail.Location context, item_type, item_key, hazards_addressed_count, status, co_benefits_count.
funding_project_openedUser opens a project seeking funding.Location context, item_type, item_key, hazards_addressed_count, status, finance_status, funded_percent.
adaptation_goal_openedUser opens an adaptation goal.Location context, item_type, item_key, hazards_addressed_count, target_year.
solution_hazard_filter_appliedUser filters action ideas by hazard.Location properties, hazard_type, matching_solution_count.
solution_hazard_filter_clearedUser clears the action-ideas hazard filter.Location properties, hazard_type, matching_solution_count.
solution_detail_openedUser opens a solution detail modal.Location properties, solution_key, solution_category, hazards_addressed_count, peer_actions_count, pct_peer_taking_action, has_local_action, selected_hazard_filter.
ai_chat_openedAsk CDP AI panel opens.Location properties, context_area.
ai_chat_query_submittedUser submits a manual Ask CDP AI query.Location properties, context_area, sanitized/truncated query, query_length, source: manual.
ai_chat_followup_clickedUser clicks an Ask CDP AI suggested follow-up.Location properties, context_area, sanitized/truncated query, query_length, source: followup.
feedback_openedUser opens the feedback modal.path, language, viewport, optional location_id, optional location_name, optional active_tab.
user_role_selectedUser confirms or changes their role.user_type, role, previous_role, source; the selected role is also registered as a PostHog super property.

AI Server Observability

Ask CDP AI interactions also generate backend LLM telemetry from cdp-ai-engine.

DestinationEvent or traceContent captured
PostHog AI Observability$ai_generation$ai_trace_id, $ai_span_id, $ai_span_name, $ai_model, $ai_provider, $ai_stream, $ai_temperature, $ai_max_tokens, metadata such as sessionId, userId, location_name, token counts, cost fields, latency, full input, and full output.
Langfusegemini.generate_content generation traceFull input payload, output text, model, model parameters, merged metadata, usage details, latency, and cost.

PostHog stores heavy AI content outside events.properties: full prompt/input content is queryable in posthog.ai_events.input, and full output choices are queryable in posthog.ai_events.output_choices. The deploy workflow now checks those columns after every AI-server deploy.

Useful verification query:

SELECT timestamp, trace_id, event, model, input, output_choices
FROM posthog.ai_events
WHERE event = '$ai_generation'
ORDER BY timestamp DESC
LIMIT 10

Handoff Names Not Currently Emitted

The handoff and older notes reference a few names that are not present in the current frontend event-capture code:

Event nameCurrent status
section_engagedNot found in the current frontend code. Tab changes and item opens are tracked instead.
export_clicked, export_completed, export_failedNot found in the current frontend code. The success-metrics row for exports should be treated as a gap until export tracking is implemented.
peer_location_clickNot emitted. Peer solution interest is partially covered by solution_detail_opened and solution hazard-filter events.
funding_card_expandedNot emitted. Funding-card engagement is represented by funding_project_opened.

Success-Metrics Mapping

Handoff metricCurrent implementation status
Population reached via researchPartially implemented. The frontend emits location_viewed; reporting still depends on the external GA4/BigQuery/Looker pipeline described in the handoff.
General active users, sessions, session duration, geography, device, traffic sourceCovered by GA4/Looker outside this repo.
Location detail page view countCovered by GA4 location_viewed and PostHog location_viewed.
AI chat usageCovered in PostHog through open, manual query, and follow-up click events; GA also receives manual submit and suggestion click events. See Ask CDP AI weekly stats for the repeatable interest funnel reports.
Peer solution discovery ratePartially covered. The app records solution filter and detail-open events in PostHog, but it does not emit the handoff’s proposed peer_location_click event name.
Mobilization intent via PDF exportNot implemented as a PDF export metric. No export_clicked / export_completed / export_failed capture calls are present in the current frontend code.
Funding-card engagementImplemented in PostHog as funding_project_opened, not the handoff’s proposed funding_card_expanded event name.
Long-term readiness outcomesNot directly measurable in app telemetry. These remain CDP survey, disclosure, and follow-up metrics.

Operational Notes

  • The production Cloud Run URL in the Google technical handoff is useful for internal handover, but the public site metadata in the frontend points at https://cdp-action-explorer.net/.
  • The handoff’s GA DebugView setup still applies for validating location_viewed: open a location detail page, then inspect the location_viewed event and its location_id parameter in GA4.
  • PostHog autocapture is restricted to https://cdp-action-explorer.net, localhost, and 127.0.0.1. Cloud Run preview URLs rely on explicit custom events rather than PostHog autocapture.
  • Query text is sanitized and truncated before being sent to PostHog. Manual query text is not sent to GA, but follow-up suggestion text is currently sent as query_text.