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 viapackages/analytics); every store identified by the custom dimensionstore_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 viatrendyTrackinapps/storefronttemplates (gtag snippet in the layout head). purchasefires 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 noGCP_SERVICE_ACCOUNT_*configured, reporting degrades to the locally persisted events (documented).