| name | google-analytics |
| version | 1.0.0 |
| category | google |
| description | 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).
|
| triggers | ["ga4 setup","google analytics","analytics events"] |
| dependencies | [] |
| cadence | on-build | weekly |
| job_duration | medium |
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).