$npx -y skills add henkisdabro/wookstar-claude-plugins --skill google-analyticsComprehensive Google Analytics 4 guide covering property setup, events, custom events, recommended events, custom dimensions, user tracking, audiences, reporting, BigQuery integration, gtag.js implementation, GTM integration, Measurement Protocol, DebugView, privacy compliance, a
| 1 | # Google Analytics 4 Complete Guide |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Google Analytics 4 (GA4) is Google's event-based analytics platform for measuring user interactions across websites and applications. Every user interaction is tracked as an event with associated parameters, providing flexible cross-platform measurement. |
| 6 | |
| 7 | ## When to Use This Skill |
| 8 | |
| 9 | Invoke this skill for any GA4-related task: |
| 10 | |
| 11 | - Setting up GA4 properties, data streams, and Measurement IDs |
| 12 | - Installing GA4 via gtag.js, GTM, or CMS plugins |
| 13 | - Implementing event tracking (automatic, recommended, custom, ecommerce) |
| 14 | - Creating custom dimensions, audiences, and reports |
| 15 | - Exporting data to BigQuery for SQL analysis |
| 16 | - Server-side tracking via Measurement Protocol |
| 17 | - User ID and cross-device tracking |
| 18 | - Privacy compliance, Consent Mode, and GDPR/CCPA |
| 19 | - Testing and debugging with DebugView |
| 20 | |
| 21 | ## Quick Start |
| 22 | |
| 23 | 1. **Create property:** analytics.google.com -> Admin -> Create -> Property |
| 24 | 2. **Create data stream:** Add web stream, note Measurement ID (G-XXXXXXXXXX) |
| 25 | 3. **Install tracking** (choose one): |
| 26 | - **GTM (recommended):** Install container, create Google Tag with Measurement ID, trigger on All Pages, publish |
| 27 | - **gtag.js direct:** |
| 28 | ```html |
| 29 | <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script> |
| 30 | <script> |
| 31 | window.dataLayer = window.dataLayer || []; |
| 32 | function gtag(){dataLayer.push(arguments);} |
| 33 | gtag('js', new Date()); |
| 34 | gtag('config', 'G-XXXXXXXXXX'); |
| 35 | </script> |
| 36 | ``` |
| 37 | 4. **Verify:** Enable GA Debugger extension, check Admin -> DebugView for session_start, page_view |
| 38 | 5. **Send custom events:** |
| 39 | ```javascript |
| 40 | gtag('event', 'button_click', { button_name: 'Subscribe', button_location: 'header' }); |
| 41 | ``` |
| 42 | |
| 43 | ## Decision Tree: Which Reference Do I Need? |
| 44 | |
| 45 | ``` |
| 46 | What are you trying to do? |
| 47 | |
| 48 | Setting up GA4 for the first time? -> references/setup.md |
| 49 | Understanding how events work? -> references/events-fundamentals.md |
| 50 | Implementing standard tracking events? -> references/recommended-events.md |
| 51 | Creating business-specific custom events? -> references/custom-events.md |
| 52 | Making parameters appear in reports? -> references/custom-dimensions.md |
| 53 | Implementing User ID / cross-device? -> references/user-tracking.md |
| 54 | Building audiences for remarketing? -> references/audiences.md |
| 55 | Analysing data in GA4 reports? -> references/reporting.md |
| 56 | Exporting to BigQuery for SQL analysis? -> references/bigquery.md |
| 57 | Installing via gtag.js directly? -> references/gtag.md |
| 58 | Setting up GA4 in Google Tag Manager? -> references/gtm-integration.md |
| 59 | Sending events from server/backend? -> references/measurement-protocol.md |
| 60 | Testing and debugging implementation? -> references/debugview.md |
| 61 | Implementing GDPR/Consent Mode? -> references/privacy.md |
| 62 | Configuring Admin settings? -> references/data-management.md |
| 63 | ``` |
| 64 | |
| 65 | ## Core Concepts |
| 66 | |
| 67 | ### Event-Based Model |
| 68 | |
| 69 | GA4 tracks everything as events in four categories: |
| 70 | |
| 71 | | Category | Description | Examples | |
| 72 | |----------|-------------|----------| |
| 73 | | Automatic | Fire without configuration | session_start, first_visit | |
| 74 | | Enhanced Measurement | Toggle on/off in settings | scroll, click, file_download | |
| 75 | | Recommended | Google-defined with standard parameters | purchase, login, sign_up | |
| 76 | | Custom | Business-specific tracking | demo_requested, trial_started | |
| 77 | |
| 78 | ### Key Limits |
| 79 | |
| 80 | | Limit | Value | |
| 81 | |-------|-------| |
| 82 | | Event names per property | 500 distinct | |
| 83 | | Parameters per event | 25 | |
| 84 | | Event name length | 40 characters | |
| 85 | | Parameter name/value length | 40 / 100 characters | |
| 86 | | Custom dimensions (event/user/item) | 50 / 25 / 10 | |
| 87 | | Audiences per property | 100 | |
| 88 | |
| 89 | ### Measurement ID |
| 90 | |
| 91 | - Format: `G-XXXXXXXXXX` (G- prefix + 10 alphanumeric characters) |
| 92 | - Location: Admin -> Data Streams -> Web Stream |
| 93 | - Used in: gtag.js config, GTM tags, Measurement Protocol |
| 94 | |
| 95 | ## Common Workflows |
| 96 | |
| 97 | ### Ecommerce Tracking |
| 98 | |
| 99 | 1. Review [recommended events](references/recommended-events.md) for the purchase funnel: view_item -> add_to_cart -> begin_checkout -> purchase |
| 100 | 2. Structure items array (required: item_id OR item_name; recommended: price, quantity, item_category) |
| 101 | 3. Test with [DebugView](references/debugview.md), then register custom item parameters as [custom |