@friedbotstudio/create-baseline 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/README.md +7 -3
  2. package/obj/template/.claude/commands/grant-push.md +19 -0
  3. package/obj/template/.claude/commands/init-project.md +26 -4
  4. package/obj/template/.claude/hooks/consent_gate_grant.mjs +107 -0
  5. package/obj/template/.claude/hooks/git_commit_guard.mjs +224 -0
  6. package/obj/template/.claude/hooks/harness_continuation.sh +101 -34
  7. package/obj/template/.claude/hooks/lib/common.mjs +283 -0
  8. package/obj/template/.claude/hooks/lib/common.sh +1 -1
  9. package/obj/template/.claude/hooks/memory_session_start.sh +20 -6
  10. package/obj/template/.claude/hooks/memory_stop.sh +161 -2
  11. package/obj/template/.claude/hooks/spec_approval_guard.sh +1 -1
  12. package/obj/template/.claude/hooks/swarm_approval_guard.sh +1 -1
  13. package/obj/template/.claude/hooks/tests/fixtures/ac008_byte_equal_reference.txt +7 -7
  14. package/obj/template/.claude/hooks/tests/fixtures/memory_stop_landmark_baseline.txt +21 -0
  15. package/obj/template/.claude/hooks/tests/fixtures/regenerate-ac008.sh +47 -0
  16. package/obj/template/.claude/hooks/tests/memory_session_start_test.sh +7 -3
  17. package/obj/template/.claude/hooks/tests/memory_stop_intent_test.sh +329 -0
  18. package/obj/template/.claude/hooks/tests/regenerate_ac008_test.sh +99 -0
  19. package/obj/template/.claude/memory/README.md +8 -3
  20. package/obj/template/.claude/memory/backlog.md +12 -0
  21. package/obj/template/.claude/project.json +6 -1
  22. package/obj/template/.claude/settings.json +3 -4
  23. package/obj/template/.claude/skills/audit-baseline/audit.sh +39 -21
  24. package/obj/template/.claude/skills/audit-baseline/tests/fixtures/_pending_opener_only.md +3 -0
  25. package/obj/template/.claude/skills/audit-baseline/tests/fixtures/preamble_full_empty_body.md +4 -0
  26. package/obj/template/.claude/skills/audit-baseline/tests/fixtures/preamble_full_with_entries.md +9 -0
  27. package/obj/template/.claude/skills/audit-baseline/tests/fixtures/preamble_no_opener.md +3 -0
  28. package/obj/template/.claude/skills/audit-baseline/tests/fixtures/preamble_opener_only.md +3 -0
  29. package/obj/template/.claude/skills/audit-baseline/tests/preamble_check_test.sh +147 -0
  30. package/obj/template/.claude/skills/chore/SKILL.md +5 -3
  31. package/obj/template/.claude/skills/commit/SKILL.md +5 -4
  32. package/obj/template/.claude/skills/copywriting/LICENSE +21 -0
  33. package/obj/template/.claude/skills/copywriting/NOTICE +23 -0
  34. package/obj/template/.claude/skills/copywriting/SKILL.md +1 -1
  35. package/obj/template/.claude/skills/design-ui/SKILL.md +23 -5
  36. package/obj/template/.claude/skills/design-ui/references/design-vs-development.md +26 -5
  37. package/obj/template/.claude/skills/design-ui/references/orchestration.md +1 -0
  38. package/obj/template/.claude/skills/design-ui/references/state-machine.md +5 -3
  39. package/obj/template/.claude/skills/documentation/LICENSE +202 -0
  40. package/obj/template/.claude/skills/documentation/NOTICE +22 -0
  41. package/obj/template/.claude/skills/google-analytics/SKILL.md +129 -0
  42. package/obj/template/.claude/skills/google-analytics/references/audiences.md +389 -0
  43. package/obj/template/.claude/skills/google-analytics/references/bigquery.md +470 -0
  44. package/obj/template/.claude/skills/google-analytics/references/custom-dimensions.md +355 -0
  45. package/obj/template/.claude/skills/google-analytics/references/custom-events.md +383 -0
  46. package/obj/template/.claude/skills/google-analytics/references/data-management.md +416 -0
  47. package/obj/template/.claude/skills/google-analytics/references/debugview.md +364 -0
  48. package/obj/template/.claude/skills/google-analytics/references/events-fundamentals.md +398 -0
  49. package/obj/template/.claude/skills/google-analytics/references/gtag.md +502 -0
  50. package/obj/template/.claude/skills/google-analytics/references/gtm-integration.md +483 -0
  51. package/obj/template/.claude/skills/google-analytics/references/measurement-protocol.md +519 -0
  52. package/obj/template/.claude/skills/google-analytics/references/privacy.md +441 -0
  53. package/obj/template/.claude/skills/google-analytics/references/recommended-events.md +464 -0
  54. package/obj/template/.claude/skills/google-analytics/references/reporting.md +397 -0
  55. package/obj/template/.claude/skills/google-analytics/references/setup.md +344 -0
  56. package/obj/template/.claude/skills/google-analytics/references/user-tracking.md +417 -0
  57. package/obj/template/.claude/skills/harness/SKILL.md +3 -1
  58. package/obj/template/.claude/skills/humanizer/LICENSE +21 -0
  59. package/obj/template/.claude/skills/humanizer/NOTICE +21 -0
  60. package/obj/template/.claude/skills/impeccable/LICENSE +202 -0
  61. package/obj/template/.claude/skills/impeccable/NOTICE +24 -0
  62. package/obj/template/.claude/skills/memory-flush/SKILL.md +20 -4
  63. package/obj/template/.claude/skills/memory-flush/sweep.py +74 -6
  64. package/obj/template/.claude/skills/memory-flush/tests/run.sh +300 -1
  65. package/obj/template/.claude/skills/optimize-seo/SKILL.md +313 -0
  66. package/obj/template/.claude/skills/optimize-seo/scripts/pagespeed.mjs +197 -0
  67. package/obj/template/.claude/skills/pagespeed-insights/LICENSE.md +37 -0
  68. package/obj/template/.claude/skills/pagespeed-insights/SKILL.md +446 -0
  69. package/obj/template/.claude/skills/pagespeed-insights/reference.md +50 -0
  70. package/obj/template/.claude/skills/tdd/SKILL.md +2 -1
  71. package/obj/template/.claude/skills/tdd/drift_check.py +180 -0
  72. package/obj/template/.claude/skills/tdd/tests/drift_check_test.sh +190 -0
  73. package/obj/template/.claude/skills/tdd/tests/run.sh +21 -0
  74. package/obj/template/.claude/skills/technical-tutorials/LICENSE +21 -0
  75. package/obj/template/.claude/skills/technical-tutorials/NOTICE +23 -0
  76. package/obj/template/.claude/skills/technical-tutorials/SKILL.md +1 -1
  77. package/obj/template/.claude/skills/triage/SKILL.md +8 -3
  78. package/obj/template/CLAUDE.md +37 -26
  79. package/obj/template/docs/init/seed.md +38 -23
  80. package/obj/template/manifest.json +80 -33
  81. package/package.json +1 -1
  82. package/src/CLAUDE.template.md +37 -26
  83. package/src/memory/backlog.template.md +12 -0
  84. package/src/project.template.json +6 -1
  85. package/src/seed.template.md +38 -23
  86. package/src/settings.template.json +3 -4
  87. package/obj/template/.claude/hooks/consent_gate_grant.sh +0 -89
  88. package/obj/template/.claude/hooks/git_commit_guard.sh +0 -93
@@ -0,0 +1,398 @@
1
+ # GA4 Events Fundamentals
2
+
3
+ Comprehensive guide to GA4 event architecture including event types, parameters, scopes, and naming conventions.
4
+
5
+ ## Overview
6
+
7
+ Google Analytics 4 uses an event-based architecture where every user interaction is tracked as an event. Understanding GA4's event structure, parameter system, and scoping model is fundamental to successful implementation.
8
+
9
+ ## Event-Based Model
10
+
11
+ Unlike Universal Analytics (session-based), GA4 tracks everything as events:
12
+
13
+ - Page views are events
14
+ - Clicks are events
15
+ - Purchases are events
16
+ - Custom interactions are events
17
+
18
+ Each event has a name and optional parameters providing context.
19
+
20
+ ## Four Event Categories
21
+
22
+ ### 1. Automatically Collected Events
23
+
24
+ Events that fire without additional configuration once GA4 is installed.
25
+
26
+ | Event | Description | When Fired |
27
+ |-------|-------------|------------|
28
+ | session_start | Session begins | First event in session |
29
+ | first_visit | User's first visit | First ever session |
30
+ | user_engagement | Page in focus | After 1+ second focused |
31
+ | page_view | Page loads | With Enhanced Measurement |
32
+
33
+ These events cannot be disabled and always fire when conditions are met.
34
+
35
+ ### 2. Enhanced Measurement Events
36
+
37
+ Automatically tracked interactions that can be toggled on/off in GA4 settings.
38
+
39
+ | Event | Trigger | Configuration |
40
+ |-------|---------|---------------|
41
+ | scroll | 90% vertical scroll depth | Data Stream settings |
42
+ | click | Outbound link clicks | Data Stream settings |
43
+ | file_download | PDF, DOC, ZIP, etc. | Data Stream settings |
44
+ | video_start | YouTube video starts | Requires JS API |
45
+ | video_progress | 10%, 25%, 50%, 75% | Requires JS API |
46
+ | video_complete | Video finishes | Requires JS API |
47
+ | view_search_results | Site search performed | Query parameter config |
48
+ | form_start | First form interaction | Data Stream settings |
49
+ | form_submit | Form submission | Data Stream settings |
50
+
51
+ **Enabling/Disabling:**
52
+ Admin -> Data Streams -> Stream -> Enhanced Measurement (gear icon)
53
+
54
+ ### 3. Recommended Events
55
+
56
+ Google-defined event names with standardised parameters for consistency.
57
+
58
+ **Engagement Events:**
59
+ - login (method parameter)
60
+ - sign_up (method parameter)
61
+ - search (search_term parameter)
62
+ - share (method, content_type parameters)
63
+
64
+ **Monetisation Events:**
65
+ - purchase (transaction_id, value, currency, items)
66
+ - add_to_cart (items, value, currency)
67
+ - remove_from_cart (items)
68
+ - begin_checkout (items, value, currency)
69
+ - add_payment_info (payment_type)
70
+ - add_shipping_info (shipping_tier)
71
+ - refund (transaction_id, value, items)
72
+
73
+ **Content Events:**
74
+ - view_item (items)
75
+ - view_item_list (items, item_list_id)
76
+ - select_item (items)
77
+ - view_promotion (promotion_id, promotion_name)
78
+ - select_promotion (promotion_id, promotion_name)
79
+
80
+ ### 4. Custom Events
81
+
82
+ Business-specific events created for unique tracking needs.
83
+
84
+ **Examples:**
85
+ - video_tutorial_watched
86
+ - whitepaper_downloaded
87
+ - demo_requested
88
+ - pricing_calculator_used
89
+ - support_ticket_created
90
+
91
+ ## Event Structure
92
+
93
+ Every GA4 event consists of:
94
+
95
+ ```
96
+ Event
97
+ ├── event_name (required, max 40 chars)
98
+ ├── event_parameters (optional, max 25 per event)
99
+ │ ├── parameter_name: value
100
+ │ ├── parameter_name: value
101
+ │ └── ...
102
+ ├── event_timestamp (automatic)
103
+ └── user_information (automatic)
104
+ ```
105
+
106
+ **Example Event:**
107
+ ```javascript
108
+ gtag('event', 'purchase', {
109
+ 'transaction_id': 'TXN_12345',
110
+ 'value': 99.99,
111
+ 'currency': 'USD',
112
+ 'items': [
113
+ {
114
+ 'item_id': 'SKU_001',
115
+ 'item_name': 'Blue T-Shirt',
116
+ 'price': 29.99,
117
+ 'quantity': 2
118
+ }
119
+ ]
120
+ });
121
+ ```
122
+
123
+ ## Parameter Scopes
124
+
125
+ Parameters apply at different scopes depending on their purpose.
126
+
127
+ ### Event Scope
128
+
129
+ Applies to a single event occurrence only.
130
+
131
+ **Use for:** Event-specific information
132
+ **Lifespan:** That specific event
133
+ **Examples:** button_name, form_id, video_title
134
+
135
+ ```javascript
136
+ gtag('event', 'button_click', {
137
+ 'button_name': 'Subscribe', // Event-scoped
138
+ 'button_location': 'header', // Event-scoped
139
+ 'button_id': 'btn_subscribe_01' // Event-scoped
140
+ });
141
+ ```
142
+
143
+ ### User Scope
144
+
145
+ Applies to all events from that user during the session.
146
+
147
+ **Use for:** User attributes that persist
148
+ **Lifespan:** Session (until cleared)
149
+ **Examples:** subscription_tier, customer_segment, loyalty_level
150
+
151
+ ```javascript
152
+ gtag('set', 'user_properties', {
153
+ 'subscription_tier': 'premium', // User-scoped
154
+ 'customer_lifetime_value': 5000, // User-scoped
155
+ 'preferred_language': 'en' // User-scoped
156
+ });
157
+ ```
158
+
159
+ ### Item Scope
160
+
161
+ Applies to individual items in ecommerce events.
162
+
163
+ **Use for:** Product-specific information
164
+ **Lifespan:** That transaction only
165
+ **Examples:** item_color, item_size, supplier_name
166
+
167
+ ```javascript
168
+ gtag('event', 'purchase', {
169
+ 'items': [
170
+ {
171
+ 'item_id': 'SKU_123',
172
+ 'item_name': 'Blue T-Shirt',
173
+ 'item_color': 'blue', // Item-scoped
174
+ 'item_size': 'large', // Item-scoped
175
+ 'supplier': 'Vendor A' // Item-scoped
176
+ }
177
+ ]
178
+ });
179
+ ```
180
+
181
+ ## Event and Parameter Limits
182
+
183
+ ### Property Limits
184
+
185
+ | Limit | Standard GA4 | GA4 360 |
186
+ |-------|-------------|---------|
187
+ | Distinct event names | 500 | 2,000 |
188
+ | Event-scoped dimensions | 50 | 125 |
189
+ | User-scoped dimensions | 25 | 100 |
190
+ | Item-scoped dimensions | 10 | 25 |
191
+ | Custom metrics | 50 | 125 |
192
+ | Calculated metrics | 5 | 50 |
193
+
194
+ ### Per-Event Limits
195
+
196
+ | Limit | Value |
197
+ |-------|-------|
198
+ | Parameters per event | 25 |
199
+ | Event name length | 40 characters |
200
+ | Parameter name length | 40 characters |
201
+ | Parameter value length | 100 characters |
202
+ | Items array size | 27 items |
203
+
204
+ ### Special Parameter Limits
205
+
206
+ | Parameter | Max Length |
207
+ |-----------|------------|
208
+ | page_title | 300 characters |
209
+ | page_referrer | 420 characters |
210
+ | page_location | 1,000 characters |
211
+
212
+ ## Event Naming Conventions
213
+
214
+ ### Best Practices
215
+
216
+ - Use snake_case (lowercase with underscores)
217
+ - Be descriptive and action-oriented
218
+ - Start with verb when possible
219
+ - Keep under 40 characters
220
+ - Avoid generic names
221
+
222
+ ### Naming Pattern
223
+
224
+ ```
225
+ [action]_[object]_[context]
226
+
227
+ Examples:
228
+ - video_tutorial_started
229
+ - whitepaper_downloaded
230
+ - demo_request_submitted
231
+ - pricing_calculator_used
232
+ ```
233
+
234
+ ### Good Examples
235
+
236
+ | Event Name | Purpose |
237
+ |------------|---------|
238
+ | video_tutorial_watched | User completed video |
239
+ | product_comparison_viewed | User compared products |
240
+ | trial_signup_completed | User signed up for trial |
241
+ | support_ticket_created | User created support issue |
242
+
243
+ ### Bad Examples
244
+
245
+ | Event Name | Problem |
246
+ |------------|---------|
247
+ | event1 | Too generic |
248
+ | click | Not descriptive |
249
+ | MyCustomEvent | Wrong case (not snake_case) |
250
+ | data | Meaningless |
251
+ | very_long_descriptive_event_name_that_exceeds_limits | Too long |
252
+
253
+ ## Reserved Event Names
254
+
255
+ Do not use these names (reserved by Google):
256
+
257
+ - ad_activeview
258
+ - ad_click
259
+ - ad_exposure
260
+ - ad_impression
261
+ - ad_query
262
+ - adunit_exposure
263
+ - app_clear_data
264
+ - app_install
265
+ - app_update
266
+ - app_remove
267
+ - error
268
+ - first_open
269
+ - first_visit
270
+ - in_app_purchase
271
+ - notification_dismiss
272
+ - notification_foreground
273
+ - notification_open
274
+ - notification_receive
275
+ - os_update
276
+ - screen_view
277
+ - session_start
278
+ - user_engagement
279
+
280
+ ## Reserved Parameter Names
281
+
282
+ Do not use these parameter names:
283
+
284
+ - firebase_conversion
285
+ - Parameters starting with:
286
+ - google_
287
+ - ga_
288
+ - firebase_
289
+
290
+ ## Common Event Parameters
291
+
292
+ ### Standard Parameters
293
+
294
+ | Parameter | Type | Description |
295
+ |-----------|------|-------------|
296
+ | value | Number | Monetary value |
297
+ | currency | String | ISO currency code (USD, EUR) |
298
+ | transaction_id | String | Unique transaction ID |
299
+ | items | Array | Product objects |
300
+ | method | String | Login/signup method |
301
+ | search_term | String | User search query |
302
+
303
+ ### Automatically Collected Parameters
304
+
305
+ These are collected automatically with each event:
306
+
307
+ - page_location
308
+ - page_referrer
309
+ - page_title
310
+ - language
311
+ - screen_resolution
312
+ - engagement_time_msec
313
+
314
+ ## Accessing Event Data
315
+
316
+ ### DebugView (Real-time)
317
+
318
+ - Location: Admin -> DebugView
319
+ - Shows live event stream
320
+ - Click event to see parameters
321
+ - Best for testing
322
+
323
+ ### Realtime Reports (30 minutes)
324
+
325
+ - Location: Reports -> Realtime
326
+ - Event count by name
327
+ - Active users
328
+ - Geographic location
329
+
330
+ ### Standard Reports (24hr+ delay)
331
+
332
+ - Location: Reports -> Engagement -> Events
333
+ - All event activity
334
+ - Event counts and trends
335
+ - Parameter breakdown (if registered as dimensions)
336
+
337
+ ## Implementation Examples
338
+
339
+ ### Simple Event
340
+
341
+ ```javascript
342
+ gtag('event', 'button_click', {
343
+ 'button_name': 'Subscribe',
344
+ 'button_location': 'header'
345
+ });
346
+ ```
347
+
348
+ ### Form Submission
349
+
350
+ ```javascript
351
+ gtag('event', 'form_submit', {
352
+ 'form_name': 'Contact Form',
353
+ 'form_id': 'contact-form',
354
+ 'form_destination': '/thank-you'
355
+ });
356
+ ```
357
+
358
+ ### Video Engagement
359
+
360
+ ```javascript
361
+ gtag('event', 'video_watched', {
362
+ 'video_title': 'Getting Started Guide',
363
+ 'video_id': 'VID_001',
364
+ 'video_duration': 180,
365
+ 'video_percent': 100
366
+ });
367
+ ```
368
+
369
+ ### Purchase
370
+
371
+ ```javascript
372
+ gtag('event', 'purchase', {
373
+ 'transaction_id': 'TXN_' + Date.now(),
374
+ 'value': 149.99,
375
+ 'currency': 'USD',
376
+ 'tax': 10.00,
377
+ 'shipping': 5.99,
378
+ 'items': [
379
+ {
380
+ 'item_id': 'SKU_123',
381
+ 'item_name': 'Premium Widget',
382
+ 'item_category': 'Electronics',
383
+ 'price': 149.99,
384
+ 'quantity': 1
385
+ }
386
+ ]
387
+ });
388
+ ```
389
+
390
+ ## Next Steps
391
+
392
+ After understanding event fundamentals:
393
+
394
+ 1. Review recommended events for your use case
395
+ 2. Design custom events for business-specific tracking
396
+ 3. Register parameters as custom dimensions
397
+ 4. Implement via gtag.js or GTM
398
+ 5. Test with DebugView