@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.
- package/README.md +7 -3
- package/obj/template/.claude/commands/grant-push.md +19 -0
- package/obj/template/.claude/commands/init-project.md +26 -4
- package/obj/template/.claude/hooks/consent_gate_grant.mjs +107 -0
- package/obj/template/.claude/hooks/git_commit_guard.mjs +224 -0
- package/obj/template/.claude/hooks/harness_continuation.sh +101 -34
- package/obj/template/.claude/hooks/lib/common.mjs +283 -0
- package/obj/template/.claude/hooks/lib/common.sh +1 -1
- package/obj/template/.claude/hooks/memory_session_start.sh +20 -6
- package/obj/template/.claude/hooks/memory_stop.sh +161 -2
- package/obj/template/.claude/hooks/spec_approval_guard.sh +1 -1
- package/obj/template/.claude/hooks/swarm_approval_guard.sh +1 -1
- package/obj/template/.claude/hooks/tests/fixtures/ac008_byte_equal_reference.txt +7 -7
- package/obj/template/.claude/hooks/tests/fixtures/memory_stop_landmark_baseline.txt +21 -0
- package/obj/template/.claude/hooks/tests/fixtures/regenerate-ac008.sh +47 -0
- package/obj/template/.claude/hooks/tests/memory_session_start_test.sh +7 -3
- package/obj/template/.claude/hooks/tests/memory_stop_intent_test.sh +329 -0
- package/obj/template/.claude/hooks/tests/regenerate_ac008_test.sh +99 -0
- package/obj/template/.claude/memory/README.md +8 -3
- package/obj/template/.claude/memory/backlog.md +12 -0
- package/obj/template/.claude/project.json +6 -1
- package/obj/template/.claude/settings.json +3 -4
- package/obj/template/.claude/skills/audit-baseline/audit.sh +39 -21
- package/obj/template/.claude/skills/audit-baseline/tests/fixtures/_pending_opener_only.md +3 -0
- package/obj/template/.claude/skills/audit-baseline/tests/fixtures/preamble_full_empty_body.md +4 -0
- package/obj/template/.claude/skills/audit-baseline/tests/fixtures/preamble_full_with_entries.md +9 -0
- package/obj/template/.claude/skills/audit-baseline/tests/fixtures/preamble_no_opener.md +3 -0
- package/obj/template/.claude/skills/audit-baseline/tests/fixtures/preamble_opener_only.md +3 -0
- package/obj/template/.claude/skills/audit-baseline/tests/preamble_check_test.sh +147 -0
- package/obj/template/.claude/skills/chore/SKILL.md +5 -3
- package/obj/template/.claude/skills/commit/SKILL.md +5 -4
- package/obj/template/.claude/skills/copywriting/LICENSE +21 -0
- package/obj/template/.claude/skills/copywriting/NOTICE +23 -0
- package/obj/template/.claude/skills/copywriting/SKILL.md +1 -1
- package/obj/template/.claude/skills/design-ui/SKILL.md +23 -5
- package/obj/template/.claude/skills/design-ui/references/design-vs-development.md +26 -5
- package/obj/template/.claude/skills/design-ui/references/orchestration.md +1 -0
- package/obj/template/.claude/skills/design-ui/references/state-machine.md +5 -3
- package/obj/template/.claude/skills/documentation/LICENSE +202 -0
- package/obj/template/.claude/skills/documentation/NOTICE +22 -0
- package/obj/template/.claude/skills/google-analytics/SKILL.md +129 -0
- package/obj/template/.claude/skills/google-analytics/references/audiences.md +389 -0
- package/obj/template/.claude/skills/google-analytics/references/bigquery.md +470 -0
- package/obj/template/.claude/skills/google-analytics/references/custom-dimensions.md +355 -0
- package/obj/template/.claude/skills/google-analytics/references/custom-events.md +383 -0
- package/obj/template/.claude/skills/google-analytics/references/data-management.md +416 -0
- package/obj/template/.claude/skills/google-analytics/references/debugview.md +364 -0
- package/obj/template/.claude/skills/google-analytics/references/events-fundamentals.md +398 -0
- package/obj/template/.claude/skills/google-analytics/references/gtag.md +502 -0
- package/obj/template/.claude/skills/google-analytics/references/gtm-integration.md +483 -0
- package/obj/template/.claude/skills/google-analytics/references/measurement-protocol.md +519 -0
- package/obj/template/.claude/skills/google-analytics/references/privacy.md +441 -0
- package/obj/template/.claude/skills/google-analytics/references/recommended-events.md +464 -0
- package/obj/template/.claude/skills/google-analytics/references/reporting.md +397 -0
- package/obj/template/.claude/skills/google-analytics/references/setup.md +344 -0
- package/obj/template/.claude/skills/google-analytics/references/user-tracking.md +417 -0
- package/obj/template/.claude/skills/harness/SKILL.md +3 -1
- package/obj/template/.claude/skills/humanizer/LICENSE +21 -0
- package/obj/template/.claude/skills/humanizer/NOTICE +21 -0
- package/obj/template/.claude/skills/impeccable/LICENSE +202 -0
- package/obj/template/.claude/skills/impeccable/NOTICE +24 -0
- package/obj/template/.claude/skills/memory-flush/SKILL.md +20 -4
- package/obj/template/.claude/skills/memory-flush/sweep.py +74 -6
- package/obj/template/.claude/skills/memory-flush/tests/run.sh +300 -1
- package/obj/template/.claude/skills/optimize-seo/SKILL.md +313 -0
- package/obj/template/.claude/skills/optimize-seo/scripts/pagespeed.mjs +197 -0
- package/obj/template/.claude/skills/pagespeed-insights/LICENSE.md +37 -0
- package/obj/template/.claude/skills/pagespeed-insights/SKILL.md +446 -0
- package/obj/template/.claude/skills/pagespeed-insights/reference.md +50 -0
- package/obj/template/.claude/skills/tdd/SKILL.md +2 -1
- package/obj/template/.claude/skills/tdd/drift_check.py +180 -0
- package/obj/template/.claude/skills/tdd/tests/drift_check_test.sh +190 -0
- package/obj/template/.claude/skills/tdd/tests/run.sh +21 -0
- package/obj/template/.claude/skills/technical-tutorials/LICENSE +21 -0
- package/obj/template/.claude/skills/technical-tutorials/NOTICE +23 -0
- package/obj/template/.claude/skills/technical-tutorials/SKILL.md +1 -1
- package/obj/template/.claude/skills/triage/SKILL.md +8 -3
- package/obj/template/CLAUDE.md +37 -26
- package/obj/template/docs/init/seed.md +38 -23
- package/obj/template/manifest.json +80 -33
- package/package.json +1 -1
- package/src/CLAUDE.template.md +37 -26
- package/src/memory/backlog.template.md +12 -0
- package/src/project.template.json +6 -1
- package/src/seed.template.md +38 -23
- package/src/settings.template.json +3 -4
- package/obj/template/.claude/hooks/consent_gate_grant.sh +0 -89
- package/obj/template/.claude/hooks/git_commit_guard.sh +0 -93
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
# GA4 Recommended Events
|
|
2
|
+
|
|
3
|
+
Complete guide to implementing Google-defined recommended events including ecommerce, engagement, and monetisation events.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
GA4 provides recommended event names and parameter structures defined by Google for consistency across analytics implementations. These standardised events enable key features like ecommerce reports, conversion modelling, and Google Ads integration.
|
|
8
|
+
|
|
9
|
+
## Why Use Recommended Events
|
|
10
|
+
|
|
11
|
+
1. **Standard reporting** - Pre-built reports for recommended events
|
|
12
|
+
2. **Google Ads integration** - Automatic conversion import
|
|
13
|
+
3. **Machine learning** - Better predictive audiences
|
|
14
|
+
4. **Consistency** - Cross-property comparison
|
|
15
|
+
5. **Future compatibility** - New features use standard events
|
|
16
|
+
|
|
17
|
+
## Recommended Events Categories
|
|
18
|
+
|
|
19
|
+
### Engagement Events
|
|
20
|
+
|
|
21
|
+
| Event | Description | Key Parameters |
|
|
22
|
+
|-------|-------------|----------------|
|
|
23
|
+
| login | User authentication | method |
|
|
24
|
+
| sign_up | Account creation | method |
|
|
25
|
+
| search | Site search | search_term |
|
|
26
|
+
| share | Content sharing | method, content_type, item_id |
|
|
27
|
+
| select_content | Content selection | content_type, item_id |
|
|
28
|
+
|
|
29
|
+
### Monetisation Events (Ecommerce)
|
|
30
|
+
|
|
31
|
+
| Event | Description | Key Parameters |
|
|
32
|
+
|-------|-------------|----------------|
|
|
33
|
+
| view_item | Product page view | items, value, currency |
|
|
34
|
+
| view_item_list | Product list view | items, item_list_id, item_list_name |
|
|
35
|
+
| select_item | Product selected | items |
|
|
36
|
+
| add_to_cart | Cart addition | items, value, currency |
|
|
37
|
+
| remove_from_cart | Cart removal | items |
|
|
38
|
+
| view_cart | Cart viewed | items, value, currency |
|
|
39
|
+
| begin_checkout | Checkout started | items, value, currency |
|
|
40
|
+
| add_shipping_info | Shipping selected | shipping_tier, items |
|
|
41
|
+
| add_payment_info | Payment entered | payment_type, items |
|
|
42
|
+
| purchase | Transaction complete | transaction_id, value, currency, items |
|
|
43
|
+
| refund | Purchase refunded | transaction_id, value, items |
|
|
44
|
+
|
|
45
|
+
### Promotion Events
|
|
46
|
+
|
|
47
|
+
| Event | Description | Key Parameters |
|
|
48
|
+
|-------|-------------|----------------|
|
|
49
|
+
| view_promotion | Promotion displayed | promotion_id, promotion_name, items |
|
|
50
|
+
| select_promotion | Promotion clicked | promotion_id, promotion_name, items |
|
|
51
|
+
|
|
52
|
+
### Other Recommended Events
|
|
53
|
+
|
|
54
|
+
| Event | Description | Key Parameters |
|
|
55
|
+
|-------|-------------|----------------|
|
|
56
|
+
| add_to_wishlist | Wishlist addition | items, value, currency |
|
|
57
|
+
| generate_lead | Lead generation | value, currency |
|
|
58
|
+
|
|
59
|
+
## The Items Array
|
|
60
|
+
|
|
61
|
+
The items array is critical for ecommerce tracking. Each item object can contain:
|
|
62
|
+
|
|
63
|
+
### Required (At Least One)
|
|
64
|
+
|
|
65
|
+
| Parameter | Type | Description |
|
|
66
|
+
|-----------|------|-------------|
|
|
67
|
+
| item_id | string | Product SKU |
|
|
68
|
+
| item_name | string | Product name |
|
|
69
|
+
|
|
70
|
+
### Highly Recommended
|
|
71
|
+
|
|
72
|
+
| Parameter | Type | Description |
|
|
73
|
+
|-----------|------|-------------|
|
|
74
|
+
| price | number | Unit price |
|
|
75
|
+
| quantity | integer | Number of units |
|
|
76
|
+
| item_category | string | Primary category |
|
|
77
|
+
|
|
78
|
+
### Optional
|
|
79
|
+
|
|
80
|
+
| Parameter | Type | Description |
|
|
81
|
+
|-----------|------|-------------|
|
|
82
|
+
| item_brand | string | Brand name |
|
|
83
|
+
| item_variant | string | Size, colour, etc. |
|
|
84
|
+
| coupon | string | Item-level coupon |
|
|
85
|
+
| discount | number | Discount amount |
|
|
86
|
+
| item_category2-5 | string | Hierarchy categories |
|
|
87
|
+
| item_list_id | string | List identifier |
|
|
88
|
+
| item_list_name | string | List name |
|
|
89
|
+
| affiliation | string | Store affiliation |
|
|
90
|
+
| location_id | string | Store location |
|
|
91
|
+
| index | integer | Position in list |
|
|
92
|
+
|
|
93
|
+
### Items Array Example
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
'items': [
|
|
97
|
+
{
|
|
98
|
+
'item_id': 'SKU_001',
|
|
99
|
+
'item_name': 'Blue T-Shirt',
|
|
100
|
+
'item_brand': 'Acme',
|
|
101
|
+
'item_category': 'Apparel',
|
|
102
|
+
'item_category2': 'T-Shirts',
|
|
103
|
+
'item_variant': 'Large',
|
|
104
|
+
'price': 29.99,
|
|
105
|
+
'quantity': 2,
|
|
106
|
+
'coupon': 'SUMMER20',
|
|
107
|
+
'discount': 5.00
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
'item_id': 'SKU_002',
|
|
111
|
+
'item_name': 'Black Jeans',
|
|
112
|
+
'item_brand': 'Acme',
|
|
113
|
+
'item_category': 'Apparel',
|
|
114
|
+
'item_category2': 'Jeans',
|
|
115
|
+
'item_variant': '32',
|
|
116
|
+
'price': 59.99,
|
|
117
|
+
'quantity': 1
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Complete Ecommerce Implementation
|
|
123
|
+
|
|
124
|
+
### Purchase Event (Most Important)
|
|
125
|
+
|
|
126
|
+
```javascript
|
|
127
|
+
gtag('event', 'purchase', {
|
|
128
|
+
'transaction_id': 'TXN_12345', // Required: unique per purchase
|
|
129
|
+
'value': 119.97, // Recommended: total value
|
|
130
|
+
'currency': 'USD', // Recommended: currency code
|
|
131
|
+
'tax': 8.40, // Optional: tax amount
|
|
132
|
+
'shipping': 9.99, // Optional: shipping cost
|
|
133
|
+
'coupon': 'SUMMER20', // Optional: order-level coupon
|
|
134
|
+
'affiliation': 'Online Store', // Optional: store name
|
|
135
|
+
'items': [
|
|
136
|
+
{
|
|
137
|
+
'item_id': 'SKU_001',
|
|
138
|
+
'item_name': 'Blue T-Shirt',
|
|
139
|
+
'item_category': 'Apparel',
|
|
140
|
+
'price': 29.99,
|
|
141
|
+
'quantity': 2
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
'item_id': 'SKU_002',
|
|
145
|
+
'item_name': 'Black Jeans',
|
|
146
|
+
'item_category': 'Apparel',
|
|
147
|
+
'price': 59.99,
|
|
148
|
+
'quantity': 1
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Full Ecommerce Journey
|
|
155
|
+
|
|
156
|
+
**1. view_item_list (Product Listing Page)**
|
|
157
|
+
|
|
158
|
+
```javascript
|
|
159
|
+
gtag('event', 'view_item_list', {
|
|
160
|
+
'item_list_id': 'category_apparel',
|
|
161
|
+
'item_list_name': 'Apparel Collection',
|
|
162
|
+
'items': [
|
|
163
|
+
{
|
|
164
|
+
'item_id': 'SKU_001',
|
|
165
|
+
'item_name': 'Blue T-Shirt',
|
|
166
|
+
'price': 29.99,
|
|
167
|
+
'index': 1
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
'item_id': 'SKU_002',
|
|
171
|
+
'item_name': 'Black Jeans',
|
|
172
|
+
'price': 59.99,
|
|
173
|
+
'index': 2
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
});
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**2. select_item (Product Click)**
|
|
180
|
+
|
|
181
|
+
```javascript
|
|
182
|
+
gtag('event', 'select_item', {
|
|
183
|
+
'item_list_id': 'category_apparel',
|
|
184
|
+
'item_list_name': 'Apparel Collection',
|
|
185
|
+
'items': [
|
|
186
|
+
{
|
|
187
|
+
'item_id': 'SKU_001',
|
|
188
|
+
'item_name': 'Blue T-Shirt',
|
|
189
|
+
'price': 29.99
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
});
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**3. view_item (Product Detail Page)**
|
|
196
|
+
|
|
197
|
+
```javascript
|
|
198
|
+
gtag('event', 'view_item', {
|
|
199
|
+
'currency': 'USD',
|
|
200
|
+
'value': 29.99,
|
|
201
|
+
'items': [
|
|
202
|
+
{
|
|
203
|
+
'item_id': 'SKU_001',
|
|
204
|
+
'item_name': 'Blue T-Shirt',
|
|
205
|
+
'item_brand': 'Acme',
|
|
206
|
+
'item_category': 'Apparel',
|
|
207
|
+
'item_variant': 'Large',
|
|
208
|
+
'price': 29.99
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
});
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**4. add_to_cart**
|
|
215
|
+
|
|
216
|
+
```javascript
|
|
217
|
+
gtag('event', 'add_to_cart', {
|
|
218
|
+
'currency': 'USD',
|
|
219
|
+
'value': 59.98,
|
|
220
|
+
'items': [
|
|
221
|
+
{
|
|
222
|
+
'item_id': 'SKU_001',
|
|
223
|
+
'item_name': 'Blue T-Shirt',
|
|
224
|
+
'price': 29.99,
|
|
225
|
+
'quantity': 2
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
});
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**5. view_cart**
|
|
232
|
+
|
|
233
|
+
```javascript
|
|
234
|
+
gtag('event', 'view_cart', {
|
|
235
|
+
'currency': 'USD',
|
|
236
|
+
'value': 119.97,
|
|
237
|
+
'items': [
|
|
238
|
+
{
|
|
239
|
+
'item_id': 'SKU_001',
|
|
240
|
+
'item_name': 'Blue T-Shirt',
|
|
241
|
+
'price': 29.99,
|
|
242
|
+
'quantity': 2
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
'item_id': 'SKU_002',
|
|
246
|
+
'item_name': 'Black Jeans',
|
|
247
|
+
'price': 59.99,
|
|
248
|
+
'quantity': 1
|
|
249
|
+
}
|
|
250
|
+
]
|
|
251
|
+
});
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
**6. begin_checkout**
|
|
255
|
+
|
|
256
|
+
```javascript
|
|
257
|
+
gtag('event', 'begin_checkout', {
|
|
258
|
+
'currency': 'USD',
|
|
259
|
+
'value': 119.97,
|
|
260
|
+
'coupon': 'SUMMER20',
|
|
261
|
+
'items': [
|
|
262
|
+
{
|
|
263
|
+
'item_id': 'SKU_001',
|
|
264
|
+
'item_name': 'Blue T-Shirt',
|
|
265
|
+
'price': 29.99,
|
|
266
|
+
'quantity': 2
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
'item_id': 'SKU_002',
|
|
270
|
+
'item_name': 'Black Jeans',
|
|
271
|
+
'price': 59.99,
|
|
272
|
+
'quantity': 1
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
});
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
**7. add_shipping_info**
|
|
279
|
+
|
|
280
|
+
```javascript
|
|
281
|
+
gtag('event', 'add_shipping_info', {
|
|
282
|
+
'currency': 'USD',
|
|
283
|
+
'value': 119.97,
|
|
284
|
+
'shipping_tier': 'Express',
|
|
285
|
+
'items': [/* same items array */]
|
|
286
|
+
});
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
**8. add_payment_info**
|
|
290
|
+
|
|
291
|
+
```javascript
|
|
292
|
+
gtag('event', 'add_payment_info', {
|
|
293
|
+
'currency': 'USD',
|
|
294
|
+
'value': 119.97,
|
|
295
|
+
'payment_type': 'Credit Card',
|
|
296
|
+
'items': [/* same items array */]
|
|
297
|
+
});
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**9. purchase** (see complete example above)
|
|
301
|
+
|
|
302
|
+
## Engagement Events Implementation
|
|
303
|
+
|
|
304
|
+
### login Event
|
|
305
|
+
|
|
306
|
+
```javascript
|
|
307
|
+
gtag('event', 'login', {
|
|
308
|
+
'method': 'Google' // or 'Email', 'Facebook', etc.
|
|
309
|
+
});
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### sign_up Event
|
|
313
|
+
|
|
314
|
+
```javascript
|
|
315
|
+
gtag('event', 'sign_up', {
|
|
316
|
+
'method': 'Email'
|
|
317
|
+
});
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### search Event
|
|
321
|
+
|
|
322
|
+
```javascript
|
|
323
|
+
gtag('event', 'search', {
|
|
324
|
+
'search_term': 'blue t-shirt'
|
|
325
|
+
});
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### share Event
|
|
329
|
+
|
|
330
|
+
```javascript
|
|
331
|
+
gtag('event', 'share', {
|
|
332
|
+
'method': 'Twitter',
|
|
333
|
+
'content_type': 'article',
|
|
334
|
+
'item_id': 'ARTICLE_123'
|
|
335
|
+
});
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### generate_lead Event
|
|
339
|
+
|
|
340
|
+
```javascript
|
|
341
|
+
gtag('event', 'generate_lead', {
|
|
342
|
+
'currency': 'USD',
|
|
343
|
+
'value': 50.00 // Estimated lead value
|
|
344
|
+
});
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## GTM Implementation
|
|
348
|
+
|
|
349
|
+
### Data Layer Push
|
|
350
|
+
|
|
351
|
+
```javascript
|
|
352
|
+
dataLayer.push({
|
|
353
|
+
'event': 'purchase',
|
|
354
|
+
'ecommerce': {
|
|
355
|
+
'transaction_id': 'TXN_12345',
|
|
356
|
+
'value': 119.97,
|
|
357
|
+
'currency': 'USD',
|
|
358
|
+
'tax': 8.40,
|
|
359
|
+
'shipping': 9.99,
|
|
360
|
+
'items': [
|
|
361
|
+
{
|
|
362
|
+
'item_id': 'SKU_001',
|
|
363
|
+
'item_name': 'Blue T-Shirt',
|
|
364
|
+
'price': 29.99,
|
|
365
|
+
'quantity': 2
|
|
366
|
+
}
|
|
367
|
+
]
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### GTM Configuration
|
|
373
|
+
|
|
374
|
+
1. Create Data Layer Variables for ecommerce parameters
|
|
375
|
+
2. Create Custom Event trigger for 'purchase'
|
|
376
|
+
3. Create GA4 Event tag:
|
|
377
|
+
- Event Name: purchase
|
|
378
|
+
- Map ecommerce parameters to event parameters
|
|
379
|
+
4. Test in Preview mode
|
|
380
|
+
5. Publish
|
|
381
|
+
|
|
382
|
+
## Critical Implementation Rules
|
|
383
|
+
|
|
384
|
+
### Transaction ID
|
|
385
|
+
|
|
386
|
+
- **Must be unique** for each purchase
|
|
387
|
+
- Same transaction_id = duplicate (deduped by GA4)
|
|
388
|
+
- Use order number or generate unique ID
|
|
389
|
+
|
|
390
|
+
### Currency
|
|
391
|
+
|
|
392
|
+
- **Always include** with monetary events
|
|
393
|
+
- Use ISO 4217 codes (USD, EUR, GBP, AUD)
|
|
394
|
+
- Same currency for value and item prices
|
|
395
|
+
|
|
396
|
+
### Items Array
|
|
397
|
+
|
|
398
|
+
- Include at least item_id OR item_name (required)
|
|
399
|
+
- Keep items array consistent across events
|
|
400
|
+
- Maximum 27 items per event
|
|
401
|
+
|
|
402
|
+
### Value Calculation
|
|
403
|
+
|
|
404
|
+
- Should match sum of (price * quantity) for all items
|
|
405
|
+
- Include discounts in calculation
|
|
406
|
+
- Exclude tax and shipping from item values
|
|
407
|
+
|
|
408
|
+
## Testing Recommended Events
|
|
409
|
+
|
|
410
|
+
### DebugView Validation
|
|
411
|
+
|
|
412
|
+
1. Enable debug mode
|
|
413
|
+
2. Complete user journey
|
|
414
|
+
3. For each event, verify:
|
|
415
|
+
- Event name matches exactly
|
|
416
|
+
- All required parameters present
|
|
417
|
+
- Parameter values correct
|
|
418
|
+
- Items array structure valid
|
|
419
|
+
|
|
420
|
+
### Ecommerce Validation Checklist
|
|
421
|
+
|
|
422
|
+
- [ ] view_item fires on product pages
|
|
423
|
+
- [ ] add_to_cart fires when adding items
|
|
424
|
+
- [ ] begin_checkout fires at checkout start
|
|
425
|
+
- [ ] purchase fires once per transaction
|
|
426
|
+
- [ ] transaction_id is unique
|
|
427
|
+
- [ ] Value matches cart total
|
|
428
|
+
- [ ] Currency included on all monetary events
|
|
429
|
+
- [ ] Items array populated correctly
|
|
430
|
+
|
|
431
|
+
## Common Issues
|
|
432
|
+
|
|
433
|
+
### Duplicate Purchases
|
|
434
|
+
|
|
435
|
+
**Cause:** Same transaction_id sent multiple times
|
|
436
|
+
**Solution:** Ensure unique ID, implement prevention logic
|
|
437
|
+
|
|
438
|
+
### Missing Revenue
|
|
439
|
+
|
|
440
|
+
**Cause:** Currency parameter missing
|
|
441
|
+
**Solution:** Always include currency with value
|
|
442
|
+
|
|
443
|
+
### Empty Items Array
|
|
444
|
+
|
|
445
|
+
**Cause:** Data not available when event fires
|
|
446
|
+
**Solution:** Validate items array before sending
|
|
447
|
+
|
|
448
|
+
### Wrong Event Names
|
|
449
|
+
|
|
450
|
+
**Cause:** Using custom names instead of recommended
|
|
451
|
+
**Solution:** Use exact recommended event names (case-sensitive)
|
|
452
|
+
|
|
453
|
+
## Key Events (Conversions)
|
|
454
|
+
|
|
455
|
+
Mark recommended events as key events for conversion tracking:
|
|
456
|
+
|
|
457
|
+
1. Admin -> Events
|
|
458
|
+
2. Find event (e.g., purchase)
|
|
459
|
+
3. Toggle "Mark as key event"
|
|
460
|
+
|
|
461
|
+
Events marked as key events:
|
|
462
|
+
- Appear in conversion reports
|
|
463
|
+
- Can be imported to Google Ads
|
|
464
|
+
- Used for optimisation
|