@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.
- package/README.md +14 -10
- package/bin/cli.js +19 -13
- package/obj/template/.claude/commands/init-project-doctor.md +74 -0
- package/obj/template/.claude/hooks/lib/resume_writer.py +14 -1
- package/obj/template/.claude/hooks/memory_session_start.sh +24 -0
- package/obj/template/.claude/hooks/track_guard.sh +11 -1
- package/obj/template/.claude/manifest.json +31 -99
- package/obj/template/.claude/schemas/workflow-track.v1.json +64 -0
- package/obj/template/.claude/skills/audit-baseline/audit.sh +2 -2
- package/obj/template/.claude/skills/chore/SKILL.md +2 -2
- package/obj/template/.claude/skills/harness/SKILL.md +15 -6
- package/obj/template/.claude/skills/intake/SKILL.md +1 -1
- package/obj/template/.claude/skills/swarm-plan/SKILL.md +2 -0
- package/obj/template/.claude/skills/tdd/SKILL.md +2 -2
- package/obj/template/.claude/skills/triage/SKILL.md +29 -6
- package/obj/template/.claude/skills/triage/seed-tasklist.mjs +107 -0
- package/obj/template/.claude/skills/upgrade-project/SKILL.md +18 -7
- package/obj/template/.claude/workflows.jsonl +6 -0
- package/obj/template/CLAUDE.md +8 -14
- package/obj/template/docs/init/seed.md +148 -3
- package/package.json +1 -1
- package/src/.claude/workflows.template.jsonl +6 -0
- package/src/CLAUDE.template.md +8 -14
- package/src/cli/install.js +5 -1
- package/src/cli/merge.js +42 -5
- package/src/cli/track-tasklist-materializer.js +223 -0
- package/src/cli/tui/upgrade.js +30 -41
- package/src/cli/upgrade-tiers.js +42 -4
- package/src/cli/workflow-migrator.js +40 -0
- package/src/cli/workflows-validator-invariants.js +417 -0
- package/src/cli/workflows-validator-predicates.js +19 -0
- package/src/cli/workflows-validator.js +156 -0
- package/src/seed.template.md +148 -3
- package/obj/template/.claude/skills/google-analytics/SKILL.md +0 -129
- package/obj/template/.claude/skills/google-analytics/references/audiences.md +0 -389
- package/obj/template/.claude/skills/google-analytics/references/bigquery.md +0 -470
- package/obj/template/.claude/skills/google-analytics/references/custom-dimensions.md +0 -355
- package/obj/template/.claude/skills/google-analytics/references/custom-events.md +0 -383
- package/obj/template/.claude/skills/google-analytics/references/data-management.md +0 -416
- package/obj/template/.claude/skills/google-analytics/references/debugview.md +0 -364
- package/obj/template/.claude/skills/google-analytics/references/events-fundamentals.md +0 -398
- package/obj/template/.claude/skills/google-analytics/references/gtag.md +0 -502
- package/obj/template/.claude/skills/google-analytics/references/gtm-integration.md +0 -483
- package/obj/template/.claude/skills/google-analytics/references/measurement-protocol.md +0 -519
- package/obj/template/.claude/skills/google-analytics/references/privacy.md +0 -441
- package/obj/template/.claude/skills/google-analytics/references/recommended-events.md +0 -464
- package/obj/template/.claude/skills/google-analytics/references/reporting.md +0 -397
- package/obj/template/.claude/skills/google-analytics/references/setup.md +0 -344
- package/obj/template/.claude/skills/google-analytics/references/user-tracking.md +0 -417
- package/obj/template/.claude/skills/optimize-seo/SKILL.md +0 -313
- package/obj/template/.claude/skills/optimize-seo/scripts/pagespeed.mjs +0 -197
- package/obj/template/.claude/skills/pagespeed-insights/LICENSE.md +0 -37
- package/obj/template/.claude/skills/pagespeed-insights/SKILL.md +0 -446
- package/obj/template/.claude/skills/pagespeed-insights/reference.md +0 -50
- package/src/cli/diff-render.js +0 -54
|
@@ -1,417 +0,0 @@
|
|
|
1
|
-
# GA4 User ID and Cross-Device Tracking
|
|
2
|
-
|
|
3
|
-
Complete guide to User ID implementation, user properties, and cross-device tracking in GA4.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
User ID enables cross-device tracking for authenticated users. User properties allow tracking custom user attributes across all events. Together, they provide a unified view of user behaviour across devices and sessions.
|
|
8
|
-
|
|
9
|
-
## User ID Implementation
|
|
10
|
-
|
|
11
|
-
### What is User ID
|
|
12
|
-
|
|
13
|
-
- Persistent identifier for authenticated users
|
|
14
|
-
- Enables cross-device tracking
|
|
15
|
-
- Requires explicit user authentication
|
|
16
|
-
- Must not contain PII (hash if needed)
|
|
17
|
-
- Set when user logs in, cleared on logout
|
|
18
|
-
|
|
19
|
-
### Implementation Methods
|
|
20
|
-
|
|
21
|
-
#### Method 1: gtag.js
|
|
22
|
-
|
|
23
|
-
**On Login:**
|
|
24
|
-
```javascript
|
|
25
|
-
// Set User ID when user logs in
|
|
26
|
-
gtag('config', 'G-XXXXXXXXXX', {
|
|
27
|
-
'user_id': 'USER_12345'
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// Or use gtag('set')
|
|
31
|
-
gtag('set', 'user_id', 'USER_12345');
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
**On Logout:**
|
|
35
|
-
```javascript
|
|
36
|
-
// Clear User ID - MUST use null, never empty string
|
|
37
|
-
gtag('set', 'user_id', null);
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
#### Method 2: GTM Data Layer
|
|
41
|
-
|
|
42
|
-
**Push to Data Layer:**
|
|
43
|
-
```javascript
|
|
44
|
-
// On login
|
|
45
|
-
dataLayer.push({
|
|
46
|
-
'user_id': 'USER_12345'
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// On logout
|
|
50
|
-
dataLayer.push({
|
|
51
|
-
'user_id': null
|
|
52
|
-
});
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
**GTM Configuration:**
|
|
56
|
-
1. Create Data Layer Variable: `user_id`
|
|
57
|
-
2. In GA4 Configuration tag, add parameter:
|
|
58
|
-
- Parameter: `user_id`
|
|
59
|
-
- Value: `{{DL - User ID}}`
|
|
60
|
-
|
|
61
|
-
#### Method 3: Measurement Protocol
|
|
62
|
-
|
|
63
|
-
```json
|
|
64
|
-
{
|
|
65
|
-
"client_id": "client_123",
|
|
66
|
-
"user_id": "USER_12345",
|
|
67
|
-
"events": [
|
|
68
|
-
{
|
|
69
|
-
"name": "login",
|
|
70
|
-
"params": {
|
|
71
|
-
"method": "email"
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
]
|
|
75
|
-
}
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### User ID Best Practices
|
|
79
|
-
|
|
80
|
-
| Do | Don't |
|
|
81
|
-
|----|-------|
|
|
82
|
-
| Use internal user IDs | Use email addresses |
|
|
83
|
-
| Hash sensitive IDs | Use phone numbers |
|
|
84
|
-
| Set on login | Use PII directly |
|
|
85
|
-
| Clear on logout | Use empty string to clear |
|
|
86
|
-
| Document ID format | Expose ID format publicly |
|
|
87
|
-
|
|
88
|
-
### User ID Format Examples
|
|
89
|
-
|
|
90
|
-
**Good:**
|
|
91
|
-
- `USER_12345` (internal ID)
|
|
92
|
-
- `abc123def456` (hashed value)
|
|
93
|
-
- `u_a1b2c3d4` (prefixed ID)
|
|
94
|
-
|
|
95
|
-
**Bad:**
|
|
96
|
-
- `john@example.com` (email - PII)
|
|
97
|
-
- `+1-555-123-4567` (phone - PII)
|
|
98
|
-
- `John Smith` (name - PII)
|
|
99
|
-
|
|
100
|
-
## Reporting Identity
|
|
101
|
-
|
|
102
|
-
Configure how GA4 identifies users across sessions.
|
|
103
|
-
|
|
104
|
-
### Path
|
|
105
|
-
|
|
106
|
-
Admin -> Data Settings -> Reporting Identity
|
|
107
|
-
|
|
108
|
-
### Options
|
|
109
|
-
|
|
110
|
-
| Option | Description | Best For |
|
|
111
|
-
|--------|-------------|----------|
|
|
112
|
-
| Blended | User ID + Device ID + Google Signals | Most comprehensive |
|
|
113
|
-
| Observed | User ID + Device ID only | More privacy-focused |
|
|
114
|
-
| Device-based | Device ID only | Most restrictive |
|
|
115
|
-
|
|
116
|
-
### Blended (Recommended)
|
|
117
|
-
|
|
118
|
-
- Uses User ID when available
|
|
119
|
-
- Falls back to Device ID + Google Signals
|
|
120
|
-
- Most complete user view
|
|
121
|
-
- Enables cross-device insights
|
|
122
|
-
|
|
123
|
-
### Observed
|
|
124
|
-
|
|
125
|
-
- Uses User ID and Device ID only
|
|
126
|
-
- No Google Signals data
|
|
127
|
-
- More privacy-focused
|
|
128
|
-
- Fewer users identified
|
|
129
|
-
|
|
130
|
-
### Device-based
|
|
131
|
-
|
|
132
|
-
- Uses only client_id (device)
|
|
133
|
-
- No cross-device tracking
|
|
134
|
-
- Maximum privacy
|
|
135
|
-
- Limited user insights
|
|
136
|
-
|
|
137
|
-
## User Properties
|
|
138
|
-
|
|
139
|
-
### What are User Properties
|
|
140
|
-
|
|
141
|
-
- Custom attributes set at user level
|
|
142
|
-
- Persist across all events from that user
|
|
143
|
-
- Different from event parameters
|
|
144
|
-
- Must be registered as custom dimensions to report
|
|
145
|
-
|
|
146
|
-
### Limits
|
|
147
|
-
|
|
148
|
-
| Limit | Value |
|
|
149
|
-
|-------|-------|
|
|
150
|
-
| User properties per property | 25 |
|
|
151
|
-
| Property name length | 24 characters |
|
|
152
|
-
| Property value length | 36 characters |
|
|
153
|
-
|
|
154
|
-
### Setting User Properties
|
|
155
|
-
|
|
156
|
-
**gtag.js:**
|
|
157
|
-
```javascript
|
|
158
|
-
gtag('set', 'user_properties', {
|
|
159
|
-
'user_tier': 'premium',
|
|
160
|
-
'account_age_days': 365,
|
|
161
|
-
'preferred_category': 'electronics'
|
|
162
|
-
});
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
**GTM Data Layer:**
|
|
166
|
-
```javascript
|
|
167
|
-
dataLayer.push({
|
|
168
|
-
'user_properties': {
|
|
169
|
-
'user_tier': 'premium',
|
|
170
|
-
'account_age_days': 365
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
**Measurement Protocol:**
|
|
176
|
-
```json
|
|
177
|
-
{
|
|
178
|
-
"client_id": "client_123",
|
|
179
|
-
"user_properties": {
|
|
180
|
-
"user_tier": {
|
|
181
|
-
"value": "premium"
|
|
182
|
-
},
|
|
183
|
-
"account_age_days": {
|
|
184
|
-
"value": 365
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
"events": [...]
|
|
188
|
-
}
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### Common User Properties
|
|
192
|
-
|
|
193
|
-
| Property | Values | Use Case |
|
|
194
|
-
|----------|--------|----------|
|
|
195
|
-
| user_tier | free, premium, enterprise | Segment by subscription |
|
|
196
|
-
| signup_date | YYYY-MM-DD | Cohort analysis |
|
|
197
|
-
| subscription_status | active, trial, cancelled | Revenue analysis |
|
|
198
|
-
| customer_ltv | Numeric bucket | Value segmentation |
|
|
199
|
-
| industry | Technology, Finance, etc. | B2B analysis |
|
|
200
|
-
| company_size | 1-10, 11-50, 51-200, etc. | Enterprise targeting |
|
|
201
|
-
| interests | Category string | Personalisation |
|
|
202
|
-
|
|
203
|
-
### PII Considerations
|
|
204
|
-
|
|
205
|
-
**Avoid:**
|
|
206
|
-
- email
|
|
207
|
-
- name
|
|
208
|
-
- phone_number
|
|
209
|
-
- address
|
|
210
|
-
- credit_card
|
|
211
|
-
|
|
212
|
-
**Use Instead:**
|
|
213
|
-
- email_domain
|
|
214
|
-
- first_name_initial
|
|
215
|
-
- user_segment
|
|
216
|
-
- location_region
|
|
217
|
-
|
|
218
|
-
## Cross-Device Tracking
|
|
219
|
-
|
|
220
|
-
### How It Works
|
|
221
|
-
|
|
222
|
-
1. User visits on mobile (logged in) -> user_id set
|
|
223
|
-
2. User visits on desktop (logged in) -> same user_id
|
|
224
|
-
3. GA4 stitches sessions together
|
|
225
|
-
4. Reports show unified user journey
|
|
226
|
-
|
|
227
|
-
### Requirements
|
|
228
|
-
|
|
229
|
-
- User ID implemented and set on login
|
|
230
|
-
- Google Signals enabled (for Blended identity)
|
|
231
|
-
- Users signed into Google accounts
|
|
232
|
-
- User opt-in to personalisation
|
|
233
|
-
|
|
234
|
-
### Enabling Google Signals
|
|
235
|
-
|
|
236
|
-
1. Admin -> Data Settings -> Data Collection
|
|
237
|
-
2. Enable Google Signals
|
|
238
|
-
3. Accept terms
|
|
239
|
-
4. Wait 24 hours for data
|
|
240
|
-
|
|
241
|
-
### Cross-Domain Tracking
|
|
242
|
-
|
|
243
|
-
For User ID across domains:
|
|
244
|
-
|
|
245
|
-
**gtag.js Configuration:**
|
|
246
|
-
```javascript
|
|
247
|
-
gtag('config', 'G-XXXXXXXXXX', {
|
|
248
|
-
'linker': {
|
|
249
|
-
'domains': ['example.com', 'shop.example.com', 'blog.example.com']
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
**What This Does:**
|
|
255
|
-
- Passes client_id between domains via URL parameter
|
|
256
|
-
- Preserves user_id if set
|
|
257
|
-
- Maintains session continuity
|
|
258
|
-
- Uses `_gl` URL parameter
|
|
259
|
-
|
|
260
|
-
**GTM Setup:**
|
|
261
|
-
1. In GA4 Configuration tag
|
|
262
|
-
2. Expand Configuration Settings
|
|
263
|
-
3. Add Fields to Set:
|
|
264
|
-
- Field Name: linker
|
|
265
|
-
- Value: `{"domains": ["example.com", "shop.example.com"]}`
|
|
266
|
-
|
|
267
|
-
### Testing Cross-Domain
|
|
268
|
-
|
|
269
|
-
1. Visit domain1.com
|
|
270
|
-
2. Click link to domain2.com
|
|
271
|
-
3. Verify `_gl` parameter in URL
|
|
272
|
-
4. Check DebugView shows same user
|
|
273
|
-
5. Confirm session continues
|
|
274
|
-
|
|
275
|
-
## User-Scoped Custom Dimensions
|
|
276
|
-
|
|
277
|
-
Register user properties for reporting:
|
|
278
|
-
|
|
279
|
-
### Registration
|
|
280
|
-
|
|
281
|
-
1. Admin -> Data Display -> Custom Definitions
|
|
282
|
-
2. Click "Create custom dimension"
|
|
283
|
-
3. Configure:
|
|
284
|
-
- Dimension name: "User Tier"
|
|
285
|
-
- Scope: User
|
|
286
|
-
- User property: `user_tier`
|
|
287
|
-
4. Save
|
|
288
|
-
|
|
289
|
-
### Using in Reports
|
|
290
|
-
|
|
291
|
-
- Add as dimension in Explorations
|
|
292
|
-
- Filter/segment by dimension
|
|
293
|
-
- Analyse user cohorts
|
|
294
|
-
- Compare user segments
|
|
295
|
-
|
|
296
|
-
## User Data Deletion
|
|
297
|
-
|
|
298
|
-
### GDPR/CCPA Compliance
|
|
299
|
-
|
|
300
|
-
**Path:** Admin -> Data Settings -> Data Deletion Requests
|
|
301
|
-
|
|
302
|
-
### Process
|
|
303
|
-
|
|
304
|
-
1. Click "Create deletion request"
|
|
305
|
-
2. Select parameter: User ID
|
|
306
|
-
3. Enter User ID value to delete
|
|
307
|
-
4. Choose scope: All data or date range
|
|
308
|
-
5. Submit request
|
|
309
|
-
|
|
310
|
-
### Processing
|
|
311
|
-
|
|
312
|
-
- Takes up to 72 hours
|
|
313
|
-
- Deletes ALL events for that User ID
|
|
314
|
-
- Cannot be undone
|
|
315
|
-
- Confirmation email sent
|
|
316
|
-
|
|
317
|
-
### Use Cases
|
|
318
|
-
|
|
319
|
-
- GDPR right to erasure requests
|
|
320
|
-
- CCPA deletion requests
|
|
321
|
-
- User account deletion
|
|
322
|
-
- Data cleanup
|
|
323
|
-
|
|
324
|
-
## Testing User ID
|
|
325
|
-
|
|
326
|
-
### Verification Workflow
|
|
327
|
-
|
|
328
|
-
1. **Implement User ID**
|
|
329
|
-
2. **Enable DebugView**
|
|
330
|
-
3. **Test Login:**
|
|
331
|
-
- Before login: Events have only client_id
|
|
332
|
-
- After login: Verify user_id in event details
|
|
333
|
-
4. **Test Logout:**
|
|
334
|
-
- After logout: Verify user_id cleared/null
|
|
335
|
-
5. **Test Cross-Device:**
|
|
336
|
-
- Login on Device 1
|
|
337
|
-
- Login on Device 2 with same account
|
|
338
|
-
- Verify same user_id
|
|
339
|
-
|
|
340
|
-
### DebugView Verification
|
|
341
|
-
|
|
342
|
-
1. Open Admin -> DebugView
|
|
343
|
-
2. Click any event
|
|
344
|
-
3. Expand event details
|
|
345
|
-
4. Check "User ID" field populated
|
|
346
|
-
|
|
347
|
-
### Reports Verification
|
|
348
|
-
|
|
349
|
-
- Wait 24-48 hours
|
|
350
|
-
- Check user count vs sessions
|
|
351
|
-
- Lower user count = User ID working (same user, multiple sessions)
|
|
352
|
-
|
|
353
|
-
## Common Issues
|
|
354
|
-
|
|
355
|
-
### User ID Not Appearing
|
|
356
|
-
|
|
357
|
-
**Causes:**
|
|
358
|
-
- Set after gtag config
|
|
359
|
-
- Cleared immediately
|
|
360
|
-
- Wrong parameter name
|
|
361
|
-
|
|
362
|
-
**Solutions:**
|
|
363
|
-
1. Set user_id in config call
|
|
364
|
-
2. Verify login flow
|
|
365
|
-
3. Check parameter is 'user_id' exactly
|
|
366
|
-
|
|
367
|
-
### Cross-Device Not Working
|
|
368
|
-
|
|
369
|
-
**Causes:**
|
|
370
|
-
- Different User IDs
|
|
371
|
-
- User ID not set on all devices
|
|
372
|
-
- Reporting Identity not configured
|
|
373
|
-
|
|
374
|
-
**Solutions:**
|
|
375
|
-
1. Verify same User ID across devices
|
|
376
|
-
2. Ensure login sets User ID
|
|
377
|
-
3. Check Reporting Identity = Blended
|
|
378
|
-
|
|
379
|
-
### User Properties Not in Reports
|
|
380
|
-
|
|
381
|
-
**Cause:** Not registered as custom dimensions
|
|
382
|
-
|
|
383
|
-
**Solution:**
|
|
384
|
-
1. Register as user-scoped custom dimension
|
|
385
|
-
2. Wait 24-48 hours
|
|
386
|
-
3. Use in Explorations
|
|
387
|
-
|
|
388
|
-
## Quick Reference
|
|
389
|
-
|
|
390
|
-
### Set User ID
|
|
391
|
-
|
|
392
|
-
```javascript
|
|
393
|
-
gtag('config', 'G-XXXXXXXXXX', {
|
|
394
|
-
'user_id': 'USER_123'
|
|
395
|
-
});
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
### Set User Properties
|
|
399
|
-
|
|
400
|
-
```javascript
|
|
401
|
-
gtag('set', 'user_properties', {
|
|
402
|
-
'user_tier': 'premium'
|
|
403
|
-
});
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
### Clear User ID
|
|
407
|
-
|
|
408
|
-
```javascript
|
|
409
|
-
gtag('set', 'user_id', null);
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
### Limits
|
|
413
|
-
|
|
414
|
-
- 25 user properties per property
|
|
415
|
-
- User property name: 24 characters max
|
|
416
|
-
- User property value: 36 characters max
|
|
417
|
-
- User ID: Must not contain PII
|