Overview
The Google Analytics Library in Clutch makes it easy to add analytics and event tracking to your site using Google Analytics 4 (GA4) or Google Tag Manager (GTM). It provides ready-to-use components and actions that integrate seamlessly with your layouts and pages.
Purpose
This library simplifies the setup of analytics tracking in modern web projects by:
- Providing the
GoogleAnalytics
component to enable GA4 tracking. - Providing the
GoogleTagManager
component to integrate with GTM. - Supporting custom event tracking via the
sendGoogleAnalyticsEvent
action. - Allowing visual configuration of tracking IDs directly in the Clutch builder.
- Offering real-time debugging support using Google's DebugView.
Why It Exists
Integrating Google Analytics or Tag Manager manually in React/Next.js projects often requires boilerplate setup and script injection. The Clutch Google Analytics Library removes that complexity by offering a declarative, component-based approach to:
- Track page views globally or per layout.
- Track custom interactions like button clicks.
- Debug and monitor events with ease.
It's built to reduce friction and make analytics accessible for both developers and designers working in Clutch.