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).

guillaumemeyer 6ea5824 1.4 KB Updated

File contents

Google Analytics 4

Source

Memo: google/google-analyticsAdapted (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).

guillaumemeyer/trendy/tree/main/skills/google/google-analytics commit 6ea5824f68

Frequently asked questions

npx skillmds@latest add guillaumemeyer/google-analytics