# Google Analytics

> Trendy adapter of memo `google/google-analytics` (PRD §10.1). GA4 wiring: one shared property, gtag.js on every storefront page, store identity as a custom dimension, and the 8 custom events (PRD §6.3).

- Skill: `guillaumemeyer/google-analytics` (Agent Skill)
- Install (CLI): `npx skillmds@latest add guillaumemeyer/google-analytics`
- Raw SKILL.md: https://api.skillmd.com/api/skills/guillaumemeyer/google-analytics/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Product & Planning
- Author: guillaumemeyer (https://skillmd.com/u/guillaumemeyer)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/guillaumemeyer/google-analytics

---


# Google Analytics 4

## Source
Memo: `google/google-analytics` — **Adapted** (Trendy-native).

## Role
Own the GA4 contract end-to-end: property/measurement-id configuration,
client-side event wiring, and KPI reporting into the ops dashboard and the
outcome loop.

## Trendy adaptation
- One shared property for all stores (`settings.analytics.ga4_property_id`,
  resolved via `packages/analytics`); every store identified by the custom
  dimension `store_dimension` = store slug.
- Events (PRD §6.3): `product_view`, `add_to_cart`, `checkout_started`,
  `purchase` (with revenue), `newsletter_subscribe`, `blog_view`,
  `promo_click` (M3), `search_used` — fired via `trendyTrack` in
  `apps/storefront` templates (gtag snippet in the layout head).
- `purchase` fires on the cart success return (`/cart?status=success`) with
  the order subtotal before the cart is cleared.
- Reporting: KPI queries (sessions, add-to-cart rate, purchase revenue) feed
  the back-office ops dashboard and the outcome loop's recalibration
  suggestion (`settings.scoring.recalibration_suggestion`). With no
  `GCP_SERVICE_ACCOUNT_*` configured, reporting degrades to the locally
  persisted events (documented).

