FFI Journey Analyser
AI-powered GA4 journey analysis for FE Fund Info with HubSpot and Salesforce cross-referencing
Purpose: AI-powered journey analytics for FE Fund Info (FFI). Looks up users by email or GA4 ID, cross-references HubSpot contacts, matches Salesforce leads to GA4 journeys, and generates Gemini summaries of behaviour and conversion paths.
Where it runs: Google Cloud Run (europe-west1, project ffijourney) behind Cloudflare Access at ffijourney.pacing.agency. A Cloudflare Worker proxies the custom domain to the *.run.app URL.
Last verified: July 2026
Quick Referenceâ
| Feature | Capability |
|---|---|
| Journey analyser | Email or GA4 _c_ffi lookup with AI 5-section journey summary |
| Leads intelligence | Salesforce leads enriched with GA4 match status, filters, and export |
| Audience builder | Identified GA4 users with saved filter sets and snapshot cache |
| Global data chat | Gemini Flash/Pro with aggregate BigQuery tools |
| API + MCP | 17 REST endpoints at /api/v1, 12 MCP tools |
| Reports | Six auto-discovered BigQuery analytics reports |
| Data health | 15 parallel metric jobs per /health/data refresh |
Overviewâ
FFI Journey Analyser is a client-specific deployment forked from Pacing-Agency/user-journey-analyzer. It replaces Supabase auth with Cloudflare Access and adds HubSpot mirror queries, Salesforce lead matching, and a full leads intelligence workspace.
Key capabilities:
- Dual lookup â email (HubSpot cross-reference + multi-method GA4 matching) or direct GA4
user_id/user_pseudo_id - HubSpot â GA4 matching â gclid, msclkid, li_fat_id, conversion-time window, and SF-date window
- Leads table â Salesforce CRM leads with inline rematch, CSV import, and HubSpot change badges
- Journey cache â merge-based enrichment pipeline with BigQuery cache (
ffijourney.journey_cache) - API keys â self-service rotation at
/profile; scope-gated/api/v1for automation and MCP
A reference re-implementation of FFI also exists in the AQL Journey monorepo (clients/ffi/) but the live FFI tool remains this separate codebase and deployment.
Account Accessâ
- Production URL: ffijourney.pacing.agency
- Authentication: Cloudflare Access (FFI staff Google accounts via Zero Trust policy)
- API docs: Swagger UI at
/api/v1/docs - MCP setup:
/mcp-setup(Cursor, Claude Desktop, Zed) - Account type: CLIENT_ACCESS, INTERNAL
Technology Stackâ
| Layer | Technology |
|---|---|
| Backend | Python Flask + FastAPI (/api/v1/ via DispatcherMiddleware) |
| AI | Gemini 2.5 Flash / 2.5 Pro via google-genai (Vertex, europe-west1) |
| GA4 data | BigQuery ga4-streaming-data.analytics_297687303 |
| HubSpot data | BigQuery ga4-streaming-data.hubspotdata1.ingest1 |
| Salesforce leads | BigQuery ga4-streaming-data.leads1 |
| Auth (web) | Cloudflare Access JWT |
| Auth (API) | X-API-Key (SHA-256 hashed keys in ffijourney.ffi_app.api_keys) |
| MCP | mcp_server.py (12 stdio tools) |
| Deployment | Google Cloud Run + Cloudflare Worker proxy |
Repositoryâ
- Source: Pacing-Agency/ffi-journey-analyser
- Base fork: Pacing-Agency/user-journey-analyzer
- Implementation plan:
PLAN.mdin the repository
Data Architectureâ
| Dataset | GCP project | Purpose |
|---|---|---|
analytics_297687303 | ga4-streaming-data | GA4 events (hostname filter: www.fefundinfo.com required) |
hubspotdata1 | ga4-streaming-data | HubSpot contact mirror |
leads1 | ga4-streaming-data | Salesforce leads, matching, chat sessions, HubSpot snapshots |
journey_cache | ffijourney | Enriched per-user journey cache |
audience_cache | ffijourney | Audience Builder snapshots |
ffi_app | ffijourney | API keys, admin allow-list, import log |
Primary GA4 identifier: user_id in _c_ffi format (99%+ coverage post-April 2026 GTM publish). Use user_pseudo_id for historical data before April 2026.
Local Developmentâ
git clone https://github.com/Pacing-Agency/ffi-journey-analyser.git
cd ffi-journey-analyser
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
gcloud auth application-default login
gcloud config set project ffijourney
cp run_local.example.py run_local.py # set CF_DEV_EMAIL; CF_DEV_MODE=true
python3 run_local.py
Runs at http://localhost:8080. Local dev bypasses Cloudflare JWT when CF_DEV_MODE=true.
Deploymentâ
Push to main triggers the Deploy to Cloud Run workflow (deploy.yml):
- Authenticates to GCP as
ffi-deploy-github@ffijourney.iam.gserviceaccount.com - Deploys via
gcloud run deploy --source . - Purges Cloudflare edge cache for
ffijourney.pacing.agency
Manual deploy: ./deploy.sh
CI / CDâ
| Workflow | Trigger | Purpose |
|---|---|---|
deploy.yml | Push to main | Cloud Run build, deploy, CF cache purge |
hubspot_sync.yml | Daily 07:00 UTC | HubSpot delta â BQ upsert â lead cascade |
warm-cache.yml | Daily + weekly | Audience snapshot and journey cache warm-up |
Related Toolsâ
- User Journey Tool â base platform this tool was forked from
- AQL Journey â ecommerce sibling on the shared CORE engine (separate live deployment)
- Google Analytics â GA4 property and BigQuery export
- Google Cloud â
ffijourneyandga4-streaming-dataprojects - Cloudflare â Access policy and Worker proxy for
ffijourney.pacing.agency - n8n â workflow automation (can call
/api/v1with scoped API keys)
Last Updated: July 2026
Owner: Ben Power
Status: Active (production)