@friedbotstudio/create-baseline 0.6.0 → 0.8.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 (55) hide show
  1. package/README.md +14 -10
  2. package/bin/cli.js +19 -13
  3. package/obj/template/.claude/commands/init-project-doctor.md +74 -0
  4. package/obj/template/.claude/hooks/lib/resume_writer.py +14 -1
  5. package/obj/template/.claude/hooks/memory_session_start.sh +24 -0
  6. package/obj/template/.claude/hooks/track_guard.sh +11 -1
  7. package/obj/template/.claude/manifest.json +31 -99
  8. package/obj/template/.claude/schemas/workflow-track.v1.json +64 -0
  9. package/obj/template/.claude/skills/audit-baseline/audit.sh +2 -2
  10. package/obj/template/.claude/skills/chore/SKILL.md +2 -2
  11. package/obj/template/.claude/skills/harness/SKILL.md +15 -6
  12. package/obj/template/.claude/skills/intake/SKILL.md +1 -1
  13. package/obj/template/.claude/skills/swarm-plan/SKILL.md +2 -0
  14. package/obj/template/.claude/skills/tdd/SKILL.md +2 -2
  15. package/obj/template/.claude/skills/triage/SKILL.md +29 -6
  16. package/obj/template/.claude/skills/triage/seed-tasklist.mjs +107 -0
  17. package/obj/template/.claude/skills/upgrade-project/SKILL.md +18 -7
  18. package/obj/template/.claude/workflows.jsonl +6 -0
  19. package/obj/template/CLAUDE.md +8 -14
  20. package/obj/template/docs/init/seed.md +148 -3
  21. package/package.json +1 -1
  22. package/src/.claude/workflows.template.jsonl +6 -0
  23. package/src/CLAUDE.template.md +8 -14
  24. package/src/cli/install.js +5 -1
  25. package/src/cli/merge.js +42 -5
  26. package/src/cli/track-tasklist-materializer.js +223 -0
  27. package/src/cli/tui/upgrade.js +30 -41
  28. package/src/cli/upgrade-tiers.js +42 -4
  29. package/src/cli/workflow-migrator.js +40 -0
  30. package/src/cli/workflows-validator-invariants.js +417 -0
  31. package/src/cli/workflows-validator-predicates.js +19 -0
  32. package/src/cli/workflows-validator.js +156 -0
  33. package/src/seed.template.md +148 -3
  34. package/obj/template/.claude/skills/google-analytics/SKILL.md +0 -129
  35. package/obj/template/.claude/skills/google-analytics/references/audiences.md +0 -389
  36. package/obj/template/.claude/skills/google-analytics/references/bigquery.md +0 -470
  37. package/obj/template/.claude/skills/google-analytics/references/custom-dimensions.md +0 -355
  38. package/obj/template/.claude/skills/google-analytics/references/custom-events.md +0 -383
  39. package/obj/template/.claude/skills/google-analytics/references/data-management.md +0 -416
  40. package/obj/template/.claude/skills/google-analytics/references/debugview.md +0 -364
  41. package/obj/template/.claude/skills/google-analytics/references/events-fundamentals.md +0 -398
  42. package/obj/template/.claude/skills/google-analytics/references/gtag.md +0 -502
  43. package/obj/template/.claude/skills/google-analytics/references/gtm-integration.md +0 -483
  44. package/obj/template/.claude/skills/google-analytics/references/measurement-protocol.md +0 -519
  45. package/obj/template/.claude/skills/google-analytics/references/privacy.md +0 -441
  46. package/obj/template/.claude/skills/google-analytics/references/recommended-events.md +0 -464
  47. package/obj/template/.claude/skills/google-analytics/references/reporting.md +0 -397
  48. package/obj/template/.claude/skills/google-analytics/references/setup.md +0 -344
  49. package/obj/template/.claude/skills/google-analytics/references/user-tracking.md +0 -417
  50. package/obj/template/.claude/skills/optimize-seo/SKILL.md +0 -313
  51. package/obj/template/.claude/skills/optimize-seo/scripts/pagespeed.mjs +0 -197
  52. package/obj/template/.claude/skills/pagespeed-insights/LICENSE.md +0 -37
  53. package/obj/template/.claude/skills/pagespeed-insights/SKILL.md +0 -446
  54. package/obj/template/.claude/skills/pagespeed-insights/reference.md +0 -50
  55. package/src/cli/diff-render.js +0 -54
@@ -1,483 +0,0 @@
1
- # GA4 Google Tag Manager Integration
2
-
3
- Expert guidance for implementing GA4 using Google Tag Manager including tags, triggers, variables, and data layer.
4
-
5
- ## Overview
6
-
7
- Google Tag Manager (GTM) provides a powerful, no-code approach to implementing GA4 tracking. GTM centralises tag management, enables version control, and allows updates without code changes.
8
-
9
- ## Why Use GTM
10
-
11
- | Benefit | Description |
12
- |---------|-------------|
13
- | No code changes | Update tracking without developers |
14
- | Version control | Rollback to previous versions |
15
- | Team collaboration | Multiple users, permissions |
16
- | Testing | Preview mode before publish |
17
- | Multiple tags | Manage all tags in one place |
18
- | Flexibility | Complex trigger conditions |
19
-
20
- ## GTM Container Installation
21
-
22
- ### Head Snippet
23
-
24
- Place immediately after `<head>`:
25
-
26
- ```html
27
- <!-- Google Tag Manager -->
28
- <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
29
- new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
30
- j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
31
- 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
32
- })(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
33
- <!-- End Google Tag Manager -->
34
- ```
35
-
36
- ### Body Snippet
37
-
38
- Place immediately after `<body>`:
39
-
40
- ```html
41
- <!-- Google Tag Manager (noscript) -->
42
- <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"
43
- height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
44
- <!-- End Google Tag Manager (noscript) -->
45
- ```
46
-
47
- ## GA4 Configuration Tag
48
-
49
- The base tag that initialises GA4 on all pages.
50
-
51
- ### Creating the Tag
52
-
53
- 1. GTM -> Tags -> New
54
- 2. Click "Tag Configuration"
55
- 3. Select "Google Tag"
56
- 4. Enter GA4 Measurement ID (G-XXXXXXXXXX)
57
- 5. Click "Triggering"
58
- 6. Select "Initialisation - All Pages"
59
- 7. Name tag: "GA4 - Configuration"
60
- 8. Save
61
-
62
- ### Configuration Options
63
-
64
- | Option | Description |
65
- |--------|-------------|
66
- | Send page view | Auto page view on load (default: true) |
67
- | Google Signals | Demographics, cross-device |
68
- | User ID | Cross-device tracking |
69
- | Debug mode | Enable DebugView |
70
-
71
- ### Adding User ID
72
-
73
- 1. Create Data Layer Variable for user_id
74
- 2. In Configuration tag, expand "Configuration Settings"
75
- 3. Add Fields to Set:
76
- - Field Name: user_id
77
- - Value: {{DL - User ID}}
78
-
79
- ## GA4 Event Tags
80
-
81
- Send specific events to GA4.
82
-
83
- ### Creating Event Tags
84
-
85
- 1. Tags -> New
86
- 2. Tag Configuration -> Google Tag
87
- 3. Tag ID: G-XXXXXXXXXX (same as config)
88
- 4. Event Name: enter event name
89
- 5. Event Parameters: add parameters
90
- 6. Set trigger
91
- 7. Save
92
-
93
- ### Event Tag Example: Button Click
94
-
95
- **Tag Configuration:**
96
- - Tag Type: Google Tag
97
- - Tag ID: G-XXXXXXXXXX
98
- - Event Name: button_click
99
- - Event Parameters:
100
- - button_name: {{Click Text}}
101
- - button_id: {{Click ID}}
102
- - button_location: header
103
-
104
- **Trigger:**
105
- - Trigger Type: Click - All Elements
106
- - Fire on: Some Clicks
107
- - Condition: Click ID equals "subscribe-btn"
108
-
109
- ### Event Tag Example: Form Submit
110
-
111
- **Tag Configuration:**
112
- - Tag Type: Google Tag
113
- - Tag ID: G-XXXXXXXXXX
114
- - Event Name: form_submit
115
- - Event Parameters:
116
- - form_name: {{Form Name Variable}}
117
- - form_id: {{Form ID}}
118
-
119
- **Trigger:**
120
- - Trigger Type: Form Submission
121
- - Fire on: Some Forms
122
- - Condition: Form ID equals "contact-form"
123
-
124
- ### Event Tag Example: Purchase
125
-
126
- **Tag Configuration:**
127
- - Tag Type: Google Tag
128
- - Tag ID: G-XXXXXXXXXX
129
- - Event Name: purchase
130
- - Event Parameters:
131
- - transaction_id: {{DL - Transaction ID}}
132
- - value: {{DL - Purchase Value}}
133
- - currency: {{DL - Currency}}
134
- - items: {{DL - Items}}
135
-
136
- **Trigger:**
137
- - Trigger Type: Custom Event
138
- - Event Name: purchase
139
-
140
- ## GTM Triggers
141
-
142
- ### Trigger Types
143
-
144
- | Type | Use For |
145
- |------|---------|
146
- | Page View | Page loads |
147
- | DOM Ready | After DOM parsed |
148
- | Window Loaded | After all resources |
149
- | Click - All Elements | Any click |
150
- | Click - Just Links | Link clicks only |
151
- | Form Submission | Form submits |
152
- | Custom Event | dataLayer.push events |
153
- | Scroll Depth | Scroll percentage |
154
- | Timer | Time-based |
155
- | JavaScript Error | Error tracking |
156
-
157
- ### Creating Triggers
158
-
159
- **Page View Trigger:**
160
- 1. Triggers -> New
161
- 2. Trigger Type: Page View
162
- 3. Fire on: Some Page Views
163
- 4. Condition: Page Path contains "/products"
164
- 5. Name: "Page View - Products"
165
- 6. Save
166
-
167
- **Click Trigger:**
168
- 1. Triggers -> New
169
- 2. Trigger Type: Click - All Elements
170
- 3. Fire on: Some Clicks
171
- 4. Condition: Click ID equals "cta-button"
172
- 5. Name: "Click - CTA Button"
173
- 6. Save
174
-
175
- **Custom Event Trigger:**
176
- 1. Triggers -> New
177
- 2. Trigger Type: Custom Event
178
- 3. Event Name: add_to_cart
179
- 4. Fire on: All Custom Events
180
- 5. Name: "CE - Add to Cart"
181
- 6. Save
182
-
183
- ## GTM Variables
184
-
185
- ### Built-in Variables
186
-
187
- Enable in Variables section:
188
-
189
- **Page Variables:**
190
- - Page URL
191
- - Page Hostname
192
- - Page Path
193
- - Referrer
194
-
195
- **Click Variables:**
196
- - Click Element
197
- - Click Classes
198
- - Click ID
199
- - Click Text
200
- - Click URL
201
-
202
- **Form Variables:**
203
- - Form Element
204
- - Form Classes
205
- - Form ID
206
- - Form Text
207
-
208
- ### Data Layer Variables
209
-
210
- Extract data from dataLayer.push():
211
-
212
- **Creating Variable:**
213
- 1. Variables -> User-Defined -> New
214
- 2. Variable Type: Data Layer Variable
215
- 3. Data Layer Variable Name: exact key name
216
- 4. Name: "DL - Product ID"
217
- 5. Save
218
-
219
- **Example:**
220
- ```javascript
221
- dataLayer.push({
222
- 'event': 'add_to_cart',
223
- 'product_id': 'SKU_123',
224
- 'product_name': 'Blue T-Shirt',
225
- 'product_price': 29.99
226
- });
227
- ```
228
-
229
- Variables needed:
230
- - DL - Product ID: `product_id`
231
- - DL - Product Name: `product_name`
232
- - DL - Product Price: `product_price`
233
-
234
- ### Custom JavaScript Variables
235
-
236
- For computed values:
237
-
238
- ```javascript
239
- function() {
240
- return document.title + ' | ' + window.location.pathname;
241
- }
242
- ```
243
-
244
- ## Data Layer Integration
245
-
246
- ### What is the Data Layer
247
-
248
- JavaScript object that holds structured data for GTM:
249
-
250
- ```javascript
251
- window.dataLayer = window.dataLayer || [];
252
- ```
253
-
254
- ### Pushing Events
255
-
256
- ```javascript
257
- // Simple event
258
- dataLayer.push({
259
- 'event': 'button_click',
260
- 'button_name': 'Subscribe',
261
- 'button_location': 'header'
262
- });
263
-
264
- // Ecommerce event
265
- dataLayer.push({
266
- 'event': 'purchase',
267
- 'ecommerce': {
268
- 'transaction_id': 'TXN_12345',
269
- 'value': 99.99,
270
- 'currency': 'USD',
271
- 'items': [
272
- {
273
- 'item_id': 'SKU_001',
274
- 'item_name': 'Product Name',
275
- 'price': 99.99,
276
- 'quantity': 1
277
- }
278
- ]
279
- }
280
- });
281
- ```
282
-
283
- ### GTM Listens for Event Key
284
-
285
- When dataLayer.push includes `event`, GTM can trigger tags.
286
-
287
- ## Preview Mode Testing
288
-
289
- ### Enabling Preview
290
-
291
- 1. Click "Preview" (top-right in GTM)
292
- 2. Enter website URL
293
- 3. Click "Connect"
294
- 4. Tag Assistant window opens
295
-
296
- ### What to Check
297
-
298
- **Tags Tab:**
299
- - Which tags fired
300
- - Which tags didn't fire
301
- - Firing order
302
-
303
- **Variables Tab:**
304
- - Variable values at each event
305
- - Data Layer contents
306
-
307
- **Data Layer Tab:**
308
- - All dataLayer.push calls
309
- - Event sequence
310
-
311
- **Errors Tab:**
312
- - Any configuration errors
313
- - Warning messages
314
-
315
- ### Testing Workflow
316
-
317
- 1. Enable Preview mode
318
- 2. Navigate website
319
- 3. Trigger actions (clicks, forms, purchases)
320
- 4. Verify in Tag Assistant:
321
- - Correct tags fire
322
- - Parameters populated
323
- - No errors
324
-
325
- ## Publishing Changes
326
-
327
- ### Process
328
-
329
- 1. Click "Submit" (top-right)
330
- 2. Enter Version Name (e.g., "GA4 Setup - January 2025")
331
- 3. Enter Version Description
332
- 4. Click "Publish"
333
-
334
- ### Best Practices
335
-
336
- - Use descriptive version names
337
- - Include date in version name
338
- - Document all changes
339
- - Test in Preview before publish
340
- - Keep version history clean
341
-
342
- ## Common Tag Configurations
343
-
344
- ### GA4 Configuration Tag
345
-
346
- ```
347
- Name: GA4 - Configuration
348
- Type: Google Tag
349
- Tag ID: G-XXXXXXXXXX
350
- Trigger: Initialisation - All Pages
351
- ```
352
-
353
- ### GA4 Event - Button Click
354
-
355
- ```
356
- Name: GA4 - Button Click
357
- Type: Google Tag
358
- Tag ID: G-XXXXXXXXXX
359
- Event Name: button_click
360
- Parameters:
361
- - button_name: {{Click Text}}
362
- - button_id: {{Click ID}}
363
- Trigger: Click - CTA Buttons
364
- ```
365
-
366
- ### GA4 Event - Form Submit
367
-
368
- ```
369
- Name: GA4 - Form Submit
370
- Type: Google Tag
371
- Tag ID: G-XXXXXXXXXX
372
- Event Name: form_submit
373
- Parameters:
374
- - form_name: {{DL - Form Name}}
375
- - form_id: {{Form ID}}
376
- Trigger: Form Submission
377
- ```
378
-
379
- ### GA4 Event - Purchase
380
-
381
- ```
382
- Name: GA4 - Purchase
383
- Type: Google Tag
384
- Tag ID: G-XXXXXXXXXX
385
- Event Name: purchase
386
- Parameters:
387
- - transaction_id: {{DL - Transaction ID}}
388
- - value: {{DL - Value}}
389
- - currency: {{DL - Currency}}
390
- - items: {{DL - Items}}
391
- Trigger: CE - Purchase
392
- ```
393
-
394
- ## Troubleshooting
395
-
396
- ### Tags Not Firing
397
-
398
- **Causes:**
399
- - Trigger conditions not met
400
- - Wrong variable values
401
- - Tag paused
402
-
403
- **Solutions:**
404
- 1. Check trigger conditions in Preview
405
- 2. Verify variable values
406
- 3. Ensure tag not paused
407
-
408
- ### Wrong Parameter Values
409
-
410
- **Causes:**
411
- - Incorrect variable mapping
412
- - Data layer not populated
413
- - Timing issues
414
-
415
- **Solutions:**
416
- 1. Check Data Layer in Preview
417
- 2. Verify variable names match exactly
418
- 3. Check event sequence timing
419
-
420
- ### Duplicate Events
421
-
422
- **Causes:**
423
- - Multiple tags for same event
424
- - Both GTM and gtag.js
425
- - Trigger fires multiple times
426
-
427
- **Solutions:**
428
- 1. Remove duplicate tags
429
- 2. Choose GTM OR gtag.js
430
- 3. Add trigger conditions
431
-
432
- ## Best Practices
433
-
434
- ### Naming Conventions
435
-
436
- **Tags:**
437
- - "GA4 - Configuration"
438
- - "GA4 - Purchase"
439
- - "GA4 - Form Submit"
440
-
441
- **Triggers:**
442
- - "PV - Products Pages"
443
- - "Click - CTA Buttons"
444
- - "CE - Add to Cart"
445
-
446
- **Variables:**
447
- - "DL - Product ID"
448
- - "CJS - Page Category"
449
- - "Constant - GA4 ID"
450
-
451
- ### Container Organisation
452
-
453
- - Create folders for GA4 tags
454
- - Create folders for variables
455
- - Use consistent naming
456
- - Document custom configurations
457
-
458
- ### Testing Protocol
459
-
460
- 1. Always use Preview mode
461
- 2. Test all triggers
462
- 3. Verify all parameters
463
- 4. Check DebugView
464
- 5. Then publish
465
-
466
- ## Quick Reference
467
-
468
- ### Setup Order
469
-
470
- 1. Create GA4 Configuration tag (Initialisation trigger)
471
- 2. Test with Preview
472
- 3. Create event tags
473
- 4. Create triggers
474
- 5. Create variables
475
- 6. Test with Preview
476
- 7. Publish
477
-
478
- ### Common Issues
479
-
480
- - Tags not firing: Check triggers
481
- - Wrong values: Check variables
482
- - Duplicates: Remove extra tags
483
- - No data: Verify Measurement ID