@friedbotstudio/create-baseline 0.1.0 → 0.2.1

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 (32) hide show
  1. package/README.md +5 -0
  2. package/bin/cli.js +8 -2
  3. package/obj/template/.claude/skills/audit-baseline/audit.sh +11 -5
  4. package/obj/template/.claude/skills/google-analytics/SKILL.md +129 -0
  5. package/obj/template/.claude/skills/google-analytics/references/audiences.md +389 -0
  6. package/obj/template/.claude/skills/google-analytics/references/bigquery.md +470 -0
  7. package/obj/template/.claude/skills/google-analytics/references/custom-dimensions.md +355 -0
  8. package/obj/template/.claude/skills/google-analytics/references/custom-events.md +383 -0
  9. package/obj/template/.claude/skills/google-analytics/references/data-management.md +416 -0
  10. package/obj/template/.claude/skills/google-analytics/references/debugview.md +364 -0
  11. package/obj/template/.claude/skills/google-analytics/references/events-fundamentals.md +398 -0
  12. package/obj/template/.claude/skills/google-analytics/references/gtag.md +502 -0
  13. package/obj/template/.claude/skills/google-analytics/references/gtm-integration.md +483 -0
  14. package/obj/template/.claude/skills/google-analytics/references/measurement-protocol.md +519 -0
  15. package/obj/template/.claude/skills/google-analytics/references/privacy.md +441 -0
  16. package/obj/template/.claude/skills/google-analytics/references/recommended-events.md +464 -0
  17. package/obj/template/.claude/skills/google-analytics/references/reporting.md +397 -0
  18. package/obj/template/.claude/skills/google-analytics/references/setup.md +344 -0
  19. package/obj/template/.claude/skills/google-analytics/references/user-tracking.md +417 -0
  20. package/obj/template/.claude/skills/optimize-seo/SKILL.md +313 -0
  21. package/obj/template/.claude/skills/optimize-seo/scripts/pagespeed.mjs +197 -0
  22. package/obj/template/.claude/skills/pagespeed-insights/LICENSE.md +37 -0
  23. package/obj/template/.claude/skills/pagespeed-insights/SKILL.md +446 -0
  24. package/obj/template/.claude/skills/pagespeed-insights/reference.md +50 -0
  25. package/obj/template/CLAUDE.md +3 -3
  26. package/obj/template/docs/init/seed.md +2 -2
  27. package/obj/template/manifest.json +27 -6
  28. package/package.json +7 -2
  29. package/src/CLAUDE.template.md +3 -3
  30. package/src/cli/install.js +14 -4
  31. package/src/seed.template.md +2 -2
  32. package/obj/template/.claude/hooks/lib/__pycache__/resume_writer.cpython-314.pyc +0 -0
@@ -0,0 +1,441 @@
1
+ # GA4 Privacy and Compliance
2
+
3
+ Expert guidance for GA4 privacy including GDPR, CCPA, Consent Mode v2, and data deletion.
4
+
5
+ ## Overview
6
+
7
+ GA4 provides privacy-focused features for GDPR, CCPA, and global privacy regulations including Consent Mode, data controls, and compliance workflows.
8
+
9
+ ## Consent Mode v2
10
+
11
+ ### What is Consent Mode
12
+
13
+ Google's API for communicating user consent status to GA4, Google Ads, and other Google tags.
14
+
15
+ ### Consent Parameters
16
+
17
+ | Parameter | Purpose | Values |
18
+ |-----------|---------|--------|
19
+ | ad_storage | Advertising cookies | granted / denied |
20
+ | analytics_storage | Analytics cookies | granted / denied |
21
+ | ad_user_data | User data for advertising (NEW) | granted / denied |
22
+ | ad_personalization | Personalized ads (NEW) | granted / denied |
23
+ | personalization_storage | Website personalisation | granted / denied |
24
+ | functionality_storage | Essential functionality | granted / denied |
25
+ | security_storage | Security features | granted / denied |
26
+
27
+ ### Consent Mode v2 Requirements
28
+
29
+ As of March 2024, v2 parameters required for EU/EEA:
30
+ - ad_user_data
31
+ - ad_personalization
32
+
33
+ Without these, remarketing lists won't populate for EU users.
34
+
35
+ ## Implementing Consent Mode
36
+
37
+ ### Basic gtag.js Implementation
38
+
39
+ **Step 1: Set Default Consent (BEFORE gtag.js loads)**
40
+
41
+ ```html
42
+ <script>
43
+ // Set default consent to denied
44
+ window.dataLayer = window.dataLayer || [];
45
+ function gtag(){dataLayer.push(arguments);}
46
+
47
+ gtag('consent', 'default', {
48
+ 'ad_storage': 'denied',
49
+ 'ad_user_data': 'denied',
50
+ 'ad_personalization': 'denied',
51
+ 'analytics_storage': 'denied'
52
+ });
53
+ </script>
54
+
55
+ <!-- Then load gtag.js -->
56
+ <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
57
+ <script>
58
+ gtag('js', new Date());
59
+ gtag('config', 'G-XXXXXXXXXX');
60
+ </script>
61
+ ```
62
+
63
+ **Step 2: Update Consent After User Choice**
64
+
65
+ ```javascript
66
+ // User accepts all cookies
67
+ gtag('consent', 'update', {
68
+ 'ad_storage': 'granted',
69
+ 'ad_user_data': 'granted',
70
+ 'ad_personalization': 'granted',
71
+ 'analytics_storage': 'granted'
72
+ });
73
+
74
+ // User accepts only analytics
75
+ gtag('consent', 'update', {
76
+ 'ad_storage': 'denied',
77
+ 'ad_user_data': 'denied',
78
+ 'ad_personalization': 'denied',
79
+ 'analytics_storage': 'granted'
80
+ });
81
+
82
+ // User denies all
83
+ gtag('consent', 'update', {
84
+ 'ad_storage': 'denied',
85
+ 'ad_user_data': 'denied',
86
+ 'ad_personalization': 'denied',
87
+ 'analytics_storage': 'denied'
88
+ });
89
+ ```
90
+
91
+ ### GTM Implementation
92
+
93
+ **Method 1: Using CMP Template**
94
+
95
+ Most CMPs (OneTrust, Cookiebot, etc.) provide GTM templates:
96
+
97
+ 1. Install CMP template from Community Gallery
98
+ 2. Configure default consent in template
99
+ 3. Template auto-updates consent on user choice
100
+
101
+ **Method 2: Manual GTM Setup**
102
+
103
+ **Create Consent Initialisation Tag:**
104
+
105
+ 1. Tag Type: Custom HTML
106
+ 2. Code:
107
+ ```html
108
+ <script>
109
+ window.dataLayer = window.dataLayer || [];
110
+ function gtag(){dataLayer.push(arguments);}
111
+ gtag('consent', 'default', {
112
+ 'ad_storage': 'denied',
113
+ 'analytics_storage': 'denied',
114
+ 'ad_user_data': 'denied',
115
+ 'ad_personalization': 'denied'
116
+ });
117
+ </script>
118
+ ```
119
+ 3. Trigger: Consent Initialisation - All Pages
120
+ 4. Tag firing priority: 999 (fires first)
121
+
122
+ **Create Consent Update Tag:**
123
+
124
+ 1. Tag Type: Custom HTML
125
+ 2. Trigger: Custom event from CMP
126
+
127
+ ## Regional Settings
128
+
129
+ ### EU-Specific Consent
130
+
131
+ ```javascript
132
+ // Denied for EU countries, granted elsewhere
133
+ gtag('consent', 'default', {
134
+ 'ad_storage': 'denied',
135
+ 'analytics_storage': 'denied'
136
+ }, {
137
+ 'region': ['AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI',
138
+ 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU',
139
+ 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'GB']
140
+ });
141
+
142
+ // Granted for non-EU
143
+ gtag('consent', 'default', {
144
+ 'ad_storage': 'granted',
145
+ 'analytics_storage': 'granted'
146
+ });
147
+ ```
148
+
149
+ ### California (CCPA)
150
+
151
+ ```javascript
152
+ gtag('consent', 'default', {
153
+ 'ad_storage': 'granted',
154
+ 'analytics_storage': 'granted'
155
+ }, {
156
+ 'region': ['US-CA']
157
+ });
158
+ ```
159
+
160
+ ## Consent Mode Behaviour
161
+
162
+ ### When analytics_storage = "denied"
163
+
164
+ | Feature | Behaviour |
165
+ |---------|-----------|
166
+ | Cookies | Not stored |
167
+ | client_id | Not persisted |
168
+ | Tracking | Cookieless pings |
169
+ | Modelling | Used to fill gaps |
170
+ | User journey | Limited |
171
+
172
+ ### When analytics_storage = "granted"
173
+
174
+ | Feature | Behaviour |
175
+ |---------|-----------|
176
+ | Cookies | Stored (_ga, _ga_*) |
177
+ | client_id | Persists across sessions |
178
+ | Tracking | Full functionality |
179
+ | Modelling | Not needed |
180
+ | User journey | Complete |
181
+
182
+ ### Conversion Modelling
183
+
184
+ When consent denied, GA4 uses:
185
+ - Machine learning to estimate conversions
186
+ - Aggregated, anonymised data
187
+ - Behavioural patterns
188
+ - "Modelled" label in reports
189
+
190
+ ## Data Retention
191
+
192
+ ### Configuration
193
+
194
+ **Path:** Admin -> Data Settings -> Data Retention
195
+
196
+ | Option | Use Case |
197
+ |--------|----------|
198
+ | 2 months | Privacy-focused, GDPR minimum |
199
+ | 14 months | Year-over-year analysis |
200
+
201
+ ### What's Affected
202
+
203
+ **Affected (user/event data in Explorations):**
204
+ - User-level data
205
+ - Event-level data
206
+ - User Explorer report
207
+
208
+ **Not Affected (aggregated data):**
209
+ - Standard reports
210
+ - Conversion data
211
+ - Audience data
212
+
213
+ ### Reset on New Activity
214
+
215
+ - **ON:** Timer resets when user returns
216
+ - **OFF:** Data deleted at fixed date
217
+
218
+ ## Data Deletion Requests
219
+
220
+ ### GDPR Article 17 (Right to Erasure)
221
+
222
+ **Path:** Admin -> Data Settings -> Data Deletion Requests
223
+
224
+ ### Process
225
+
226
+ 1. Click "Create deletion request"
227
+ 2. Select parameter:
228
+ - User ID
229
+ - Client ID (user_pseudo_id)
230
+ - App Instance ID
231
+ 3. Enter identifier value
232
+ 4. Choose date range or "All time"
233
+ 5. Submit request
234
+
235
+ ### Processing
236
+
237
+ - Takes up to 72 hours
238
+ - Deletes ALL events for identifier
239
+ - Cannot be undone
240
+ - Confirmation email sent
241
+
242
+ ### Best Practice
243
+
244
+ - Maintain deletion request log
245
+ - Respond within 30 days (GDPR)
246
+ - Document process in privacy policy
247
+
248
+ ## IP Anonymisation
249
+
250
+ ### GA4 Default Behaviour
251
+
252
+ - GA4 does NOT log or store IP addresses
253
+ - IP used only for geolocation derivation
254
+ - No additional anonymisation needed
255
+ - Privacy-first by design
256
+
257
+ ### Unlike Universal Analytics
258
+
259
+ - No `anonymize_ip` parameter needed
260
+ - IP never in reports or exports
261
+ - Location derived, IP discarded
262
+
263
+ ## Google Signals
264
+
265
+ ### What It Enables
266
+
267
+ - Demographics (age, gender)
268
+ - Interests reporting
269
+ - Cross-device tracking (without User ID)
270
+ - Remarketing audiences
271
+
272
+ ### Privacy Implications
273
+
274
+ - Requires consent for personalised ads
275
+ - Subject to data thresholds
276
+ - User opt-out via Ads Settings
277
+
278
+ ### Configuration
279
+
280
+ **Path:** Admin -> Data Settings -> Data Collection
281
+
282
+ - Enable only with proper consent
283
+ - Respect user opt-outs
284
+ - Document in privacy policy
285
+
286
+ ## GDPR Compliance Checklist
287
+
288
+ ### Legal Requirements
289
+
290
+ - [ ] Privacy policy updated with GA4 usage
291
+ - [ ] Cookie consent banner implemented
292
+ - [ ] Legal basis documented (consent/legitimate interest)
293
+ - [ ] DPA with Google signed
294
+ - [ ] Cross-border data transfer disclosures
295
+
296
+ ### Technical Implementation
297
+
298
+ - [ ] Consent Mode v2 configured
299
+ - [ ] All 4 v2 parameters set (ad_storage, analytics_storage, ad_user_data, ad_personalization)
300
+ - [ ] Default consent = denied for EU
301
+ - [ ] Consent updates on user acceptance
302
+ - [ ] Data retention configured
303
+
304
+ ### Operational Processes
305
+
306
+ - [ ] Data deletion process documented
307
+ - [ ] User opt-out mechanism available
308
+ - [ ] Regular privacy audit schedule
309
+ - [ ] Staff training on procedures
310
+
311
+ ## CCPA Compliance
312
+
313
+ ### Requirements
314
+
315
+ - Allow opt-out of "sale" of personal information
316
+ - "Do Not Sell My Personal Information" link
317
+ - Honor Global Privacy Control (GPC)
318
+
319
+ ### GPC Implementation
320
+
321
+ ```javascript
322
+ // Detect GPC signal
323
+ if (navigator.globalPrivacyControl) {
324
+ gtag('consent', 'update', {
325
+ 'ad_storage': 'denied',
326
+ 'ad_user_data': 'denied',
327
+ 'ad_personalization': 'denied',
328
+ 'analytics_storage': 'granted' // Analytics OK, ads denied
329
+ });
330
+ }
331
+ ```
332
+
333
+ ### GTM Variable for GPC
334
+
335
+ 1. Variable Type: JavaScript Variable
336
+ 2. Global Variable Name: `navigator.globalPrivacyControl`
337
+ 3. Use in consent logic
338
+
339
+ ## Consent Management Platforms
340
+
341
+ ### Popular CMPs
342
+
343
+ - OneTrust
344
+ - Cookiebot
345
+ - Termly
346
+ - Osano
347
+ - TrustArc
348
+
349
+ ### GTM CMP Templates
350
+
351
+ 1. Community Template Gallery -> Search CMP
352
+ 2. Install template
353
+ 3. Configure settings
354
+ 4. Auto-updates consent to GA4
355
+
356
+ ## Testing Consent Mode
357
+
358
+ ### Verification Steps
359
+
360
+ **1. DebugView Test:**
361
+ - Before consent: Check analytics_storage = denied
362
+ - After consent: Check analytics_storage = granted
363
+
364
+ **2. Check Event Parameters:**
365
+ - Look for `gcs` parameter (Google Consent State)
366
+ - Events include consent status
367
+
368
+ **3. Cookie Inspection:**
369
+ - Before consent: No `_ga` cookie
370
+ - After consent: `_ga` cookie set
371
+
372
+ **4. GTM Preview:**
373
+ - Consent Initialisation fires first
374
+ - GA4 tag respects consent
375
+ - Consent update fires on user action
376
+
377
+ ### Chrome DevTools Check
378
+
379
+ ```javascript
380
+ // Check current consent state
381
+ dataLayer.filter(item => item[0] === 'consent')
382
+ ```
383
+
384
+ ## Server-Side Consent
385
+
386
+ ### Measurement Protocol
387
+
388
+ ```json
389
+ {
390
+ "client_id": "client_123",
391
+ "consent": {
392
+ "ad_storage": "denied",
393
+ "analytics_storage": "granted",
394
+ "ad_user_data": "denied",
395
+ "ad_personalization": "denied"
396
+ },
397
+ "events": [...]
398
+ }
399
+ ```
400
+
401
+ ### Best Practice
402
+
403
+ - Pass consent from frontend to backend
404
+ - Include in all Measurement Protocol requests
405
+ - Store user preferences in database
406
+
407
+ ## Quick Reference
408
+
409
+ ### Consent Parameters (v2)
410
+
411
+ ```javascript
412
+ gtag('consent', 'default', {
413
+ 'ad_storage': 'denied',
414
+ 'analytics_storage': 'denied',
415
+ 'ad_user_data': 'denied',
416
+ 'ad_personalization': 'denied'
417
+ });
418
+ ```
419
+
420
+ ### Update After Consent
421
+
422
+ ```javascript
423
+ gtag('consent', 'update', {
424
+ 'ad_storage': 'granted',
425
+ 'analytics_storage': 'granted',
426
+ 'ad_user_data': 'granted',
427
+ 'ad_personalization': 'granted'
428
+ });
429
+ ```
430
+
431
+ ### Data Deletion
432
+
433
+ Admin -> Data Settings -> Data Deletion Requests -> Create
434
+
435
+ ### Key Compliance Points
436
+
437
+ - v2 parameters required for EU (March 2024)
438
+ - Default to denied, update on consent
439
+ - Data retention: 2 or 14 months
440
+ - No IP storage in GA4
441
+ - Respond to deletion within 30 days