docusaurus-plugin-generate-schema-docs 1.8.1 → 1.8.3
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 +17 -7
- package/__tests__/__fixtures__/validateSchemas/main-schema-with-constraints-ref.json +20 -0
- package/__tests__/__snapshots__/generateEventDocs.anchor.test.js.snap +15 -3
- package/__tests__/__snapshots__/generateEventDocs.nested.test.js.snap +20 -4
- package/__tests__/__snapshots__/generateEventDocs.test.js.snap +30 -6
- package/__tests__/__snapshots__/generateEventDocs.versioned.test.js.snap +10 -2
- package/__tests__/components/ConditionalRows.test.js +28 -0
- package/__tests__/components/FoldableRows.test.js +31 -290
- package/__tests__/components/PropertyRow.test.js +216 -0
- package/__tests__/components/SchemaJsonViewer.test.js +76 -10
- package/__tests__/components/SchemaRows.test.js +62 -12
- package/__tests__/components/__snapshots__/ConnectorLines.visualRegression.test.js.snap +3 -3
- package/__tests__/generateEventDocs.partials.test.js +95 -0
- package/__tests__/generateEventDocs.test.js +3 -0
- package/__tests__/helpers/processSchema.test.js +29 -0
- package/__tests__/helpers/schemaToTableData.test.js +112 -0
- package/__tests__/helpers/validator.test.js +32 -0
- package/components/ConditionalRows.js +6 -3
- package/components/FoldableRows.js +9 -3
- package/components/PropertiesTable.js +2 -1
- package/components/PropertyRow.js +90 -5
- package/components/SchemaJsonViewer.js +221 -4
- package/components/SchemaRows.css +98 -7
- package/components/SchemaRows.js +11 -1
- package/generateEventDocs.js +184 -18
- package/helpers/buildExampleFromSchema.js +3 -3
- package/helpers/choice-index-template.js +6 -2
- package/helpers/constraintSchemaPaths.js +46 -0
- package/helpers/file-system.js +28 -0
- package/helpers/mergeSchema.js +16 -0
- package/helpers/processSchema.js +19 -6
- package/helpers/schema-doc-template.js +7 -1
- package/helpers/schema-processing.js +4 -11
- package/helpers/schemaToExamples.js +4 -4
- package/helpers/schemaToTableData.js +68 -7
- package/helpers/validator.js +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -175,21 +175,31 @@ You can provide additional content to the generated documentation pages by creat
|
|
|
175
175
|
|
|
176
176
|
### Naming Convention
|
|
177
177
|
|
|
178
|
-
Partials must be named after the
|
|
178
|
+
Partials must be named after the generated page/event name and prefixed with an underscore. For a page/event named `my-event`, the partials are:
|
|
179
179
|
|
|
180
|
-
- `
|
|
181
|
-
- `
|
|
180
|
+
- `_my-event.mdx`: Rendered directly after the page description.
|
|
181
|
+
- `_my-event_bottom.mdx`: Rendered at the very bottom of the page.
|
|
182
182
|
|
|
183
183
|
### Location
|
|
184
184
|
|
|
185
|
-
Place
|
|
185
|
+
Place partial files in `/docs/partials` (or `versioned_docs/version-<x>/partials` for versioned docs).
|
|
186
|
+
|
|
187
|
+
The plugin supports two lookup modes:
|
|
188
|
+
|
|
189
|
+
- **Scoped partials (recommended):** `partials/<doc-subpath>/_my-event.mdx`
|
|
190
|
+
Example: `docs/partials/event-reference/_add-to-cart-event.mdx`
|
|
191
|
+
- **Basename fallback:** `partials/_my-event.mdx`
|
|
192
|
+
Fallback is only applied when the page/event name is unique. If the same name exists in multiple places, fallback is disabled to avoid accidental cross-page injection.
|
|
193
|
+
|
|
194
|
+
For authoring MDX content in partials, see the official Docusaurus docs:
|
|
195
|
+
https://docusaurus.io/docs/markdown-features/react
|
|
186
196
|
|
|
187
197
|
### Example
|
|
188
198
|
|
|
189
|
-
If you have
|
|
199
|
+
If you have `event-reference/add-to-cart-event` and `mobile-reference/add-to-cart-event`, use scoped partials to target only the web page:
|
|
190
200
|
|
|
191
|
-
- `docs/partials/
|
|
192
|
-
- `docs/partials/
|
|
201
|
+
- `docs/partials/event-reference/_add-to-cart-event.mdx`
|
|
202
|
+
- `docs/partials/event-reference/_add-to-cart-event_bottom.mdx`
|
|
193
203
|
|
|
194
204
|
## Contributing
|
|
195
205
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Main Schema with Constraints Ref",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"allOf": [
|
|
6
|
+
{
|
|
7
|
+
"$ref": "https://tracking-docs-demo.buchert.digital/constraints/schemas/firebase/v1/flat-event-params.json"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"properties": {
|
|
11
|
+
"event": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"const": "screen_view"
|
|
14
|
+
},
|
|
15
|
+
"screen_name": {
|
|
16
|
+
"type": "string"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"required": ["event", "screen_name"]
|
|
20
|
+
}
|
|
@@ -17,7 +17,11 @@ Please select one of the following options:
|
|
|
17
17
|
- [Child Event Anchor](./child-event-with-anchor)
|
|
18
18
|
- [Child Event Title](./child-event-title)
|
|
19
19
|
|
|
20
|
-
<SchemaJsonViewer
|
|
20
|
+
<SchemaJsonViewer
|
|
21
|
+
schema={{"$id":"https://example.com/parent-event-anchor.json","title":"Parent Event Anchor","description":"This is a parent event with oneOf.","type":"object","oneOf":[{"title":"Child Event Anchor","description":"This is a child event with an anchor.","$anchor":"child-event-with-anchor","type":"object","properties":{"property_a":{"type":"string"}}},{"title":"Child Event Title","description":"This is a child event with only a title.","type":"object","properties":{"property_b":{"type":"string"}}}]}}
|
|
22
|
+
sourcePath={"parent-event-anchor.json"}
|
|
23
|
+
schemaSources={{"parent-event-anchor.json":{"$id":"https://example.com/parent-event-anchor.json","title":"Parent Event Anchor","description":"This is a parent event with oneOf.","type":"object","oneOf":[{"title":"Child Event Anchor","description":"This is a child event with an anchor.","$anchor":"child-event-with-anchor","type":"object","properties":{"property_a":{"type":"string"}}},{"title":"Child Event Title","description":"This is a child event with only a title.","type":"object","properties":{"property_b":{"type":"string"}}}]}}}
|
|
24
|
+
/>
|
|
21
25
|
"
|
|
22
26
|
`;
|
|
23
27
|
|
|
@@ -44,7 +48,11 @@ This is a child event with an anchor.
|
|
|
44
48
|
schema={{"$id":"https://example.com/parent-event-anchor.json#child-event-with-anchor","title":"Child Event Anchor","description":"This is a child event with an anchor.","type":"object","$anchor":"child-event-with-anchor","properties":{"property_a":{"type":"string"}}}}
|
|
45
49
|
|
|
46
50
|
/>
|
|
47
|
-
<SchemaJsonViewer
|
|
51
|
+
<SchemaJsonViewer
|
|
52
|
+
schema={{"$id":"https://example.com/parent-event-anchor.json#child-event-with-anchor","title":"Child Event Anchor","description":"This is a child event with an anchor.","type":"object","$anchor":"child-event-with-anchor","properties":{"property_a":{"type":"string"}}}}
|
|
53
|
+
sourcePath={"parent-event-anchor.json"}
|
|
54
|
+
schemaSources={{"parent-event-anchor.json":{"$id":"https://example.com/parent-event-anchor.json","title":"Parent Event Anchor","description":"This is a parent event with oneOf.","type":"object","oneOf":[{"title":"Child Event Anchor","description":"This is a child event with an anchor.","$anchor":"child-event-with-anchor","type":"object","properties":{"property_a":{"type":"string"}}},{"title":"Child Event Title","description":"This is a child event with only a title.","type":"object","properties":{"property_b":{"type":"string"}}}]}}}
|
|
55
|
+
/>
|
|
48
56
|
|
|
49
57
|
|
|
50
58
|
"
|
|
@@ -73,7 +81,11 @@ This is a child event with only a title.
|
|
|
73
81
|
schema={{"$id":"https://example.com/parent-event-anchor.json#child-event-title","title":"Child Event Title","description":"This is a child event with only a title.","type":"object","properties":{"property_b":{"type":"string"}}}}
|
|
74
82
|
|
|
75
83
|
/>
|
|
76
|
-
<SchemaJsonViewer
|
|
84
|
+
<SchemaJsonViewer
|
|
85
|
+
schema={{"$id":"https://example.com/parent-event-anchor.json#child-event-title","title":"Child Event Title","description":"This is a child event with only a title.","type":"object","properties":{"property_b":{"type":"string"}}}}
|
|
86
|
+
sourcePath={"parent-event-anchor.json"}
|
|
87
|
+
schemaSources={{"parent-event-anchor.json":{"$id":"https://example.com/parent-event-anchor.json","title":"Parent Event Anchor","description":"This is a parent event with oneOf.","type":"object","oneOf":[{"title":"Child Event Anchor","description":"This is a child event with an anchor.","$anchor":"child-event-with-anchor","type":"object","properties":{"property_a":{"type":"string"}}},{"title":"Child Event Title","description":"This is a child event with only a title.","type":"object","properties":{"property_b":{"type":"string"}}}]}}}
|
|
88
|
+
/>
|
|
77
89
|
|
|
78
90
|
|
|
79
91
|
"
|
|
@@ -16,7 +16,11 @@ Please select one of the following options:
|
|
|
16
16
|
|
|
17
17
|
- [Child Event](./child-event)
|
|
18
18
|
|
|
19
|
-
<SchemaJsonViewer
|
|
19
|
+
<SchemaJsonViewer
|
|
20
|
+
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/parent-event.json","title":"Parent Event","type":"object","oneOf":[{"$ref":"./child-event.json"}]}}
|
|
21
|
+
sourcePath={"parent-event.json"}
|
|
22
|
+
schemaSources={{"parent-event.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/parent-event.json","title":"Parent Event","type":"object","oneOf":[{"$ref":"./child-event.json"}]},"child-event.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/child-event.json","title":"Child Event","type":"object","oneOf":[{"$ref":"./grandchild-a.json"},{"$ref":"./grandchild-b.json"}]},"grandchild-a.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/grandchild-a.json","title":"Grandchild A","type":"object","properties":{"prop_a":{"type":"string"}}},"grandchild-b.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/grandchild-b.json","title":"Grandchild B","type":"object","properties":{"prop_b":{"type":"string"}}}}}
|
|
23
|
+
/>
|
|
20
24
|
"
|
|
21
25
|
`;
|
|
22
26
|
|
|
@@ -37,7 +41,11 @@ Please select one of the following options:
|
|
|
37
41
|
- [Grandchild A](./grandchild-a)
|
|
38
42
|
- [Grandchild B](./grandchild-b)
|
|
39
43
|
|
|
40
|
-
<SchemaJsonViewer
|
|
44
|
+
<SchemaJsonViewer
|
|
45
|
+
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/child-event.json","title":"Child Event","type":"object","oneOf":[{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/grandchild-a.json","title":"Grandchild A","type":"object","properties":{"prop_a":{"type":"string"}}},{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/grandchild-b.json","title":"Grandchild B","type":"object","properties":{"prop_b":{"type":"string"}}}],"properties":{}}}
|
|
46
|
+
sourcePath={"child-event.json"}
|
|
47
|
+
schemaSources={{"child-event.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/child-event.json","title":"Child Event","type":"object","oneOf":[{"$ref":"./grandchild-a.json"},{"$ref":"./grandchild-b.json"}]},"grandchild-a.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/grandchild-a.json","title":"Grandchild A","type":"object","properties":{"prop_a":{"type":"string"}}},"grandchild-b.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/grandchild-b.json","title":"Grandchild B","type":"object","properties":{"prop_b":{"type":"string"}}}}}
|
|
48
|
+
/>
|
|
41
49
|
"
|
|
42
50
|
`;
|
|
43
51
|
|
|
@@ -64,7 +72,11 @@ undefined
|
|
|
64
72
|
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/grandchild-a.json","title":"Grandchild A","type":"object","properties":{"prop_a":{"type":"string"}}}}
|
|
65
73
|
|
|
66
74
|
/>
|
|
67
|
-
<SchemaJsonViewer
|
|
75
|
+
<SchemaJsonViewer
|
|
76
|
+
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/grandchild-a.json","title":"Grandchild A","type":"object","properties":{"prop_a":{"type":"string"}}}}
|
|
77
|
+
sourcePath={"child-event.json"}
|
|
78
|
+
schemaSources={{"child-event.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/child-event.json","title":"Child Event","type":"object","oneOf":[{"$ref":"./grandchild-a.json"},{"$ref":"./grandchild-b.json"}]},"grandchild-a.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/grandchild-a.json","title":"Grandchild A","type":"object","properties":{"prop_a":{"type":"string"}}},"grandchild-b.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/grandchild-b.json","title":"Grandchild B","type":"object","properties":{"prop_b":{"type":"string"}}}}}
|
|
79
|
+
/>
|
|
68
80
|
|
|
69
81
|
|
|
70
82
|
"
|
|
@@ -93,7 +105,11 @@ undefined
|
|
|
93
105
|
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/grandchild-b.json","title":"Grandchild B","type":"object","properties":{"prop_b":{"type":"string"}}}}
|
|
94
106
|
|
|
95
107
|
/>
|
|
96
|
-
<SchemaJsonViewer
|
|
108
|
+
<SchemaJsonViewer
|
|
109
|
+
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/grandchild-b.json","title":"Grandchild B","type":"object","properties":{"prop_b":{"type":"string"}}}}
|
|
110
|
+
sourcePath={"child-event.json"}
|
|
111
|
+
schemaSources={{"child-event.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/child-event.json","title":"Child Event","type":"object","oneOf":[{"$ref":"./grandchild-a.json"},{"$ref":"./grandchild-b.json"}]},"grandchild-a.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/grandchild-a.json","title":"Grandchild A","type":"object","properties":{"prop_a":{"type":"string"}}},"grandchild-b.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/schemas/nested/grandchild-b.json","title":"Grandchild B","type":"object","properties":{"prop_b":{"type":"string"}}}}}
|
|
112
|
+
/>
|
|
97
113
|
|
|
98
114
|
|
|
99
115
|
"
|
|
@@ -23,7 +23,11 @@ An add_to_cart event fires when a user adds one or more items to their shopping
|
|
|
23
23
|
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/add-to-cart-event.json","title":"Add to Cart Event","description":"An add_to_cart event fires when a user adds one or more items to their shopping cart. Based on Google Analytics 4 ecommerce event specifications.","type":"object","required":["event"],"$defs":{"strictObject":{"type":"object","propertyNames":{"maxLength":40,"pattern":"^[a-z0-9_]+$"},"additionalProperties":{"anyOf":[{"$ref":"#/allOf/0/$defs/strictObject"},{"type":"array","items":{"$ref":"#/allOf/0/$defs/strictObject"}},{"not":{"type":"object"}}]}}},"$ref":"#/allOf/0/$defs/strictObject","properties":{"event":{"type":"string","const":"add_to_cart","description":"The name of the event indicating a add_to_cart has occurred."},"ecommerce":{"type":"object","description":"Ecommerce related data for the purchase event.","required":["currency","items"],"x-gtm-clear":true,"properties":{"value":{"type":"number","description":"The monetary value of the event. Set value to the sum of (price * quantity) for all items in items.","examples":[30.03,99.99,45.5]},"currency":{"type":"string","description":"The currency of the items in ISO 4217 three-letter format. Required when value is set.","examples":["USD","EUR","GBP"]},"items":{"type":"array","description":"The products added to the cart.","minItems":1,"items":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/components/product.json","title":"A Product","description":"A product object representing an item for use within a purchase event, based on Google Analytics 4 ecommerce event specifications.","type":"object","required":[],"properties":{"item_id":{"type":"string","description":"The ID of the item. Either item_id or item_name is required.","examples":["SKU_12345","PROD_98765"]},"item_name":{"type":"string","description":"The name of the item. Either item_id or item_name is required.","examples":["Stan and Friends Tee","Blue Running Shoes"]},"affiliation":{"type":"string","description":"A product affiliation to indicate a supplier or store. Note: affiliation is only available at the item level.","examples":["Google Merchandise Store","Nike Store"]},"coupon":{"type":"string","description":"The coupon name/code associated with the item. Coupon parameters at event and item levels are independent.","examples":["SUMMER_FUN","WELCOME20","SAVE10"]},"discount":{"type":"number","description":"The monetary value of the discount per unit applied to the item.","examples":[2.22,5,10.5]},"index":{"type":"number","description":"The index or position of the item in a list.","examples":[0,1,2]},"item_brand":{"type":"string","description":"The brand of the item.","examples":["Google","Nike","Adidas"]},"item_category":{"type":"string","description":"The category of the item. If used as part of a category hierarchy or taxonomy, this is the first category.","examples":["Apparel","Footwear","Electronics"]},"item_category2":{"type":"string","description":"The second category hierarchy or additional taxonomy of the item.","examples":["Adult","Women","Men"]},"item_category3":{"type":"string","description":"The third category hierarchy or additional taxonomy of the item.","examples":["Shirts","Shoes","Boots"]},"item_category4":{"type":"string","description":"The fourth category hierarchy or additional taxonomy of the item.","examples":["Crew","Running","Casual"]},"item_category5":{"type":"string","description":"The fifth category hierarchy or additional taxonomy of the item.","examples":["Short sleeve","Long distance","Lightweight"]},"item_list_id":{"type":"string","description":"The ID of the list in which the item was presented to the user. If set, item_list_id at the event level is ignored. If not set, item_list_id at the event level is used if available.","examples":["related_products","search_results","recommendations"]},"item_list_name":{"type":"string","description":"The name of the list in which the item was presented to the user. If set, item_list_name at the event level is ignored. If not set, item_list_name at the event level is used if available.","examples":["Related Products","Search Results","Recommended Items"]},"item_variant":{"type":"string","description":"The item variant or unique code or description for additional item details/options.","examples":["green","Blue Size 10","M-Black"]},"location_id":{"type":"string","description":"The physical location associated with the item, such as the location of a brick-and-mortar store. It is recommended to use the Google Place ID that corresponds to the associated item. A custom location ID can also be used. Note: location_id is only available at the item level.","examples":["ChIJIQBpAG2ahYAR_6128GcTUEo","store_123","location_sf"]},"price":{"type":"number","description":"The price of the item in the specified currency unit. If a discount is applied to the item, set price to the reduced per-unit price and provide the per-unit price discount in the discount parameter.","examples":[10.01,21.01,89.99]},"quantity":{"type":"number","description":"The item quantity. If not set, quantity is set to 1.","examples":[1,2,3]},"promotion_id":{"type":"string","description":"The ID of the promotion associated with the item.","examples":["P_12345","PROMO_001"]},"promotion_name":{"type":"string","description":"The name of the promotion associated with the item.","examples":["Summer Sale","Black Friday","Flash Deal"]},"creative_name":{"type":"string","description":"The name of the promotion creative.","examples":["summer_banner2","holiday_email_v1"]},"creative_slot":{"type":"string","description":"The name of the creative slot associated with the item.","examples":["featured_app_1","top_banner","sidebar"]},"google_business_vertical":{"type":"string","description":"The business vertical for the item (e.g., 'retail').","examples":["retail","ecommerce"]}}}}}},"user_data":{"type":"object","description":"User related data.","x-gtm-clear":true}}}}
|
|
24
24
|
|
|
25
25
|
/>
|
|
26
|
-
<SchemaJsonViewer
|
|
26
|
+
<SchemaJsonViewer
|
|
27
|
+
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/add-to-cart-event.json","title":"Add to Cart Event","description":"An add_to_cart event fires when a user adds one or more items to their shopping cart. Based on Google Analytics 4 ecommerce event specifications.","type":"object","allOf":[{"$ref":"./components/dataLayer.json"}],"properties":{"event":{"type":"string","const":"add_to_cart","description":"The name of the event indicating a add_to_cart has occurred."},"ecommerce":{"type":"object","description":"Ecommerce related data for the purchase event.","properties":{"value":{"type":"number","description":"The monetary value of the event. Set value to the sum of (price * quantity) for all items in items.","examples":[30.03,99.99,45.5]},"currency":{"type":"string","description":"The currency of the items in ISO 4217 three-letter format. Required when value is set.","examples":["USD","EUR","GBP"]},"items":{"type":"array","description":"The products added to the cart.","minItems":1,"items":{"$ref":"./components/product.json"}}},"required":["currency","items"]}}}}
|
|
28
|
+
sourcePath={"add-to-cart-event.json"}
|
|
29
|
+
schemaSources={{"add-to-cart-event.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/add-to-cart-event.json","title":"Add to Cart Event","description":"An add_to_cart event fires when a user adds one or more items to their shopping cart. Based on Google Analytics 4 ecommerce event specifications.","type":"object","allOf":[{"$ref":"./components/dataLayer.json"}],"properties":{"event":{"type":"string","const":"add_to_cart","description":"The name of the event indicating a add_to_cart has occurred."},"ecommerce":{"type":"object","description":"Ecommerce related data for the purchase event.","properties":{"value":{"type":"number","description":"The monetary value of the event. Set value to the sum of (price * quantity) for all items in items.","examples":[30.03,99.99,45.5]},"currency":{"type":"string","description":"The currency of the items in ISO 4217 three-letter format. Required when value is set.","examples":["USD","EUR","GBP"]},"items":{"type":"array","description":"The products added to the cart.","minItems":1,"items":{"$ref":"./components/product.json"}}},"required":["currency","items"]}}},"components/dataLayer.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/components/dataLayer.json","title":"dataLayer","description":"Schema for the object structure pushed to the dataLayer.","type":"object","allOf":[{"$ref":"#/$defs/strictObject"}],"properties":{"event":{"type":"string","description":"The name of the event."},"ecommerce":{"type":"object","description":"Ecommerce related data.","x-gtm-clear":true},"user_data":{"type":"object","description":"User related data.","x-gtm-clear":true}},"required":["event"],"$defs":{"strictObject":{"type":"object","propertyNames":{"maxLength":40,"pattern":"^[a-z0-9_]+$"},"additionalProperties":{"anyOf":[{"$ref":"#/$defs/strictObject"},{"type":"array","items":{"$ref":"#/$defs/strictObject"}},{"not":{"type":"object"}}]}}}},"components/product.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/components/product.json","title":"A Product","description":"A product object representing an item for use within a purchase event, based on Google Analytics 4 ecommerce event specifications.","type":"object","properties":{"item_id":{"type":"string","description":"The ID of the item. Either item_id or item_name is required.","examples":["SKU_12345","PROD_98765"]},"item_name":{"type":"string","description":"The name of the item. Either item_id or item_name is required.","examples":["Stan and Friends Tee","Blue Running Shoes"]},"affiliation":{"type":"string","description":"A product affiliation to indicate a supplier or store. Note: affiliation is only available at the item level.","examples":["Google Merchandise Store","Nike Store"]},"coupon":{"type":"string","description":"The coupon name/code associated with the item. Coupon parameters at event and item levels are independent.","examples":["SUMMER_FUN","WELCOME20","SAVE10"]},"discount":{"type":"number","description":"The monetary value of the discount per unit applied to the item.","examples":[2.22,5,10.5]},"index":{"type":"number","description":"The index or position of the item in a list.","examples":[0,1,2]},"item_brand":{"type":"string","description":"The brand of the item.","examples":["Google","Nike","Adidas"]},"item_category":{"type":"string","description":"The category of the item. If used as part of a category hierarchy or taxonomy, this is the first category.","examples":["Apparel","Footwear","Electronics"]},"item_category2":{"type":"string","description":"The second category hierarchy or additional taxonomy of the item.","examples":["Adult","Women","Men"]},"item_category3":{"type":"string","description":"The third category hierarchy or additional taxonomy of the item.","examples":["Shirts","Shoes","Boots"]},"item_category4":{"type":"string","description":"The fourth category hierarchy or additional taxonomy of the item.","examples":["Crew","Running","Casual"]},"item_category5":{"type":"string","description":"The fifth category hierarchy or additional taxonomy of the item.","examples":["Short sleeve","Long distance","Lightweight"]},"item_list_id":{"type":"string","description":"The ID of the list in which the item was presented to the user. If set, item_list_id at the event level is ignored. If not set, item_list_id at the event level is used if available.","examples":["related_products","search_results","recommendations"]},"item_list_name":{"type":"string","description":"The name of the list in which the item was presented to the user. If set, item_list_name at the event level is ignored. If not set, item_list_name at the event level is used if available.","examples":["Related Products","Search Results","Recommended Items"]},"item_variant":{"type":"string","description":"The item variant or unique code or description for additional item details/options.","examples":["green","Blue Size 10","M-Black"]},"location_id":{"type":"string","description":"The physical location associated with the item, such as the location of a brick-and-mortar store. It is recommended to use the Google Place ID that corresponds to the associated item. A custom location ID can also be used. Note: location_id is only available at the item level.","examples":["ChIJIQBpAG2ahYAR_6128GcTUEo","store_123","location_sf"]},"price":{"type":"number","description":"The price of the item in the specified currency unit. If a discount is applied to the item, set price to the reduced per-unit price and provide the per-unit price discount in the discount parameter.","examples":[10.01,21.01,89.99]},"quantity":{"type":"number","description":"The item quantity. If not set, quantity is set to 1.","examples":[1,2,3]},"promotion_id":{"type":"string","description":"The ID of the promotion associated with the item.","examples":["P_12345","PROMO_001"]},"promotion_name":{"type":"string","description":"The name of the promotion associated with the item.","examples":["Summer Sale","Black Friday","Flash Deal"]},"creative_name":{"type":"string","description":"The name of the promotion creative.","examples":["summer_banner2","holiday_email_v1"]},"creative_slot":{"type":"string","description":"The name of the creative slot associated with the item.","examples":["featured_app_1","top_banner","sidebar"]},"google_business_vertical":{"type":"string","description":"The business vertical for the item (e.g., 'retail').","examples":["retail","ecommerce"]}},"required":[]}}}
|
|
30
|
+
/>
|
|
27
31
|
|
|
28
32
|
|
|
29
33
|
"
|
|
@@ -52,7 +56,11 @@ An example event that uses oneOf and anyOf.
|
|
|
52
56
|
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/1.2.0/choice-event.json","title":"Choice Event","description":"An example event that uses oneOf and anyOf.","type":"object","required":["event","user_id","payment_method"],"properties":{"event":{"type":"string","const":"one_of_event"},"user_id":{"description":"The user's ID.","oneOf":[{"type":"string","title":"User ID as String","description":"The user's ID as a string.","examples":["user-123"]},{"type":"integer","title":"User ID as Integer","description":"The user's ID as an integer.","examples":[123]}]},"payment_method":{"description":"The user's payment method.","type":"object","anyOf":[{"title":"Credit Card","properties":{"payment_type":{"type":"string","enum":["credit_card","debit_card"],"examples":["credit_card"]},"card_number":{"type":"string","examples":["1234-5678-9012-3456"]},"expiry_date":{"type":"string","examples":["12/26"]}},"required":["card_number","expiry_date"]},{"title":"PayPal","type":"object","properties":{"payment_type":{"type":"string","const":"paypal"},"email":{"type":"string","format":"email","examples":["test@example.com"]}},"required":["email"]}]}}}}
|
|
53
57
|
|
|
54
58
|
/>
|
|
55
|
-
<SchemaJsonViewer
|
|
59
|
+
<SchemaJsonViewer
|
|
60
|
+
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/1.2.0/choice-event.json","title":"Choice Event","description":"An example event that uses oneOf and anyOf.","type":"object","properties":{"event":{"type":"string","const":"one_of_event"},"user_id":{"description":"The user's ID.","oneOf":[{"type":"string","title":"User ID as String","description":"The user's ID as a string.","examples":["user-123"]},{"type":"integer","title":"User ID as Integer","description":"The user's ID as an integer.","examples":[123]}]},"payment_method":{"description":"The user's payment method.","type":"object","anyOf":[{"title":"Credit Card","properties":{"payment_type":{"type":"string","enum":["credit_card","debit_card"],"examples":["credit_card"]},"card_number":{"type":"string","examples":["1234-5678-9012-3456"]},"expiry_date":{"type":"string","examples":["12/26"]}},"required":["card_number","expiry_date"]},{"title":"PayPal","type":"object","properties":{"payment_type":{"type":"string","const":"paypal"},"email":{"type":"string","format":"email","examples":["test@example.com"]}},"required":["email"]}]}},"required":["event","user_id","payment_method"]}}
|
|
61
|
+
sourcePath={"choice-event.json"}
|
|
62
|
+
schemaSources={{"choice-event.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/1.2.0/choice-event.json","title":"Choice Event","description":"An example event that uses oneOf and anyOf.","type":"object","properties":{"event":{"type":"string","const":"one_of_event"},"user_id":{"description":"The user's ID.","oneOf":[{"type":"string","title":"User ID as String","description":"The user's ID as a string.","examples":["user-123"]},{"type":"integer","title":"User ID as Integer","description":"The user's ID as an integer.","examples":[123]}]},"payment_method":{"description":"The user's payment method.","type":"object","anyOf":[{"title":"Credit Card","properties":{"payment_type":{"type":"string","enum":["credit_card","debit_card"],"examples":["credit_card"]},"card_number":{"type":"string","examples":["1234-5678-9012-3456"]},"expiry_date":{"type":"string","examples":["12/26"]}},"required":["card_number","expiry_date"]},{"title":"PayPal","type":"object","properties":{"payment_type":{"type":"string","const":"paypal"},"email":{"type":"string","format":"email","examples":["test@example.com"]}},"required":["email"]}]}},"required":["event","user_id","payment_method"]}}}
|
|
63
|
+
/>
|
|
56
64
|
|
|
57
65
|
|
|
58
66
|
"
|
|
@@ -81,7 +89,11 @@ An example event that has anyOf at the root level.
|
|
|
81
89
|
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/1.2.0/root-any-of-event.json","title":"Root AnyOf Event","description":"An example event that has anyOf at the root level.","type":"object","anyOf":[{"title":"Has Param C","properties":{"param_c":{"type":"string","examples":["example_c"],"description":"This is the description for Param C."}}},{"title":"Has Param D","properties":{"param_d":{"type":"boolean","examples":[true]}}}],"properties":{"event":{"type":"string","const":"any_of_event"}}}}
|
|
82
90
|
|
|
83
91
|
/>
|
|
84
|
-
<SchemaJsonViewer
|
|
92
|
+
<SchemaJsonViewer
|
|
93
|
+
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/1.2.0/root-any-of-event.json","title":"Root AnyOf Event","description":"An example event that has anyOf at the root level.","type":"object","properties":{"event":{"type":"string","const":"any_of_event"}},"anyOf":[{"title":"Has Param C","properties":{"param_c":{"type":"string","examples":["example_c"],"description":"This is the description for Param C."}}},{"title":"Has Param D","properties":{"param_d":{"type":"boolean","examples":[true]}}}]}}
|
|
94
|
+
sourcePath={"root-any-of-event.json"}
|
|
95
|
+
schemaSources={{"root-any-of-event.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/1.2.0/root-any-of-event.json","title":"Root AnyOf Event","description":"An example event that has anyOf at the root level.","type":"object","properties":{"event":{"type":"string","const":"any_of_event"}},"anyOf":[{"title":"Has Param C","properties":{"param_c":{"type":"string","examples":["example_c"],"description":"This is the description for Param C."}}},{"title":"Has Param D","properties":{"param_d":{"type":"boolean","examples":[true]}}}]}}}
|
|
96
|
+
/>
|
|
85
97
|
|
|
86
98
|
|
|
87
99
|
"
|
|
@@ -104,7 +116,11 @@ Please select one of the following options:
|
|
|
104
116
|
- [Option A](./option-a)
|
|
105
117
|
- [Option B](./option-b)
|
|
106
118
|
|
|
107
|
-
<SchemaJsonViewer
|
|
119
|
+
<SchemaJsonViewer
|
|
120
|
+
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/root-choice-event.schema.json","title":"Root Choice Event","description":"An example event that has oneOf at the root level.","oneOf":[{"title":"Option A","type":"object","properties":{"event":{"type":"string","const":"option_a"},"param_a":{"type":"string","examples":["example_a"]}}},{"title":"Option B","type":"object","properties":{"event":{"type":"string","const":"option_b"},"param_b":{"type":"integer","examples":[123]}}}]}}
|
|
121
|
+
sourcePath={"root-choice-event.json"}
|
|
122
|
+
schemaSources={{"root-choice-event.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/root-choice-event.schema.json","title":"Root Choice Event","description":"An example event that has oneOf at the root level.","oneOf":[{"title":"Option A","type":"object","properties":{"event":{"type":"string","const":"option_a"},"param_a":{"type":"string","examples":["example_a"]}}},{"title":"Option B","type":"object","properties":{"event":{"type":"string","const":"option_b"},"param_b":{"type":"integer","examples":[123]}}}]}}}
|
|
123
|
+
/>
|
|
108
124
|
"
|
|
109
125
|
`;
|
|
110
126
|
|
|
@@ -131,7 +147,11 @@ An example event that has oneOf at the root level.
|
|
|
131
147
|
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/root-choice-event.schema.json#option-a","title":"Option A","description":"An example event that has oneOf at the root level.","type":"object","properties":{"event":{"type":"string","const":"option_a"},"param_a":{"type":"string","examples":["example_a"]}}}}
|
|
132
148
|
|
|
133
149
|
/>
|
|
134
|
-
<SchemaJsonViewer
|
|
150
|
+
<SchemaJsonViewer
|
|
151
|
+
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/root-choice-event.schema.json#option-a","title":"Option A","description":"An example event that has oneOf at the root level.","type":"object","properties":{"event":{"type":"string","const":"option_a"},"param_a":{"type":"string","examples":["example_a"]}}}}
|
|
152
|
+
sourcePath={"root-choice-event.json"}
|
|
153
|
+
schemaSources={{"root-choice-event.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/root-choice-event.schema.json","title":"Root Choice Event","description":"An example event that has oneOf at the root level.","oneOf":[{"title":"Option A","type":"object","properties":{"event":{"type":"string","const":"option_a"},"param_a":{"type":"string","examples":["example_a"]}}},{"title":"Option B","type":"object","properties":{"event":{"type":"string","const":"option_b"},"param_b":{"type":"integer","examples":[123]}}}]}}}
|
|
154
|
+
/>
|
|
135
155
|
|
|
136
156
|
|
|
137
157
|
"
|
|
@@ -160,7 +180,11 @@ An example event that has oneOf at the root level.
|
|
|
160
180
|
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/root-choice-event.schema.json#option-b","title":"Option B","description":"An example event that has oneOf at the root level.","type":"object","properties":{"event":{"type":"string","const":"option_b"},"param_b":{"type":"integer","examples":[123]}}}}
|
|
161
181
|
|
|
162
182
|
/>
|
|
163
|
-
<SchemaJsonViewer
|
|
183
|
+
<SchemaJsonViewer
|
|
184
|
+
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/root-choice-event.schema.json#option-b","title":"Option B","description":"An example event that has oneOf at the root level.","type":"object","properties":{"event":{"type":"string","const":"option_b"},"param_b":{"type":"integer","examples":[123]}}}}
|
|
185
|
+
sourcePath={"root-choice-event.json"}
|
|
186
|
+
schemaSources={{"root-choice-event.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://example.com/root-choice-event.schema.json","title":"Root Choice Event","description":"An example event that has oneOf at the root level.","oneOf":[{"title":"Option A","type":"object","properties":{"event":{"type":"string","const":"option_a"},"param_a":{"type":"string","examples":["example_a"]}}},{"title":"Option B","type":"object","properties":{"event":{"type":"string","const":"option_b"},"param_b":{"type":"integer","examples":[123]}}}]}}}
|
|
187
|
+
/>
|
|
164
188
|
|
|
165
189
|
|
|
166
190
|
"
|
|
@@ -23,7 +23,11 @@ An add_to_cart event fires when a user adds one or more items to their shopping
|
|
|
23
23
|
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/add-to-cart-event.json","title":"Add to Cart Event","description":"An add_to_cart event fires when a user adds one or more items to their shopping cart. Based on Google Analytics 4 ecommerce event specifications.","type":"object","required":["event"],"$defs":{"strictObject":{"type":"object","propertyNames":{"maxLength":40,"pattern":"^[a-z0-9_]+$"},"additionalProperties":{"anyOf":[{"$ref":"#/allOf/0/$defs/strictObject"},{"type":"array","items":{"$ref":"#/allOf/0/$defs/strictObject"}},{"not":{"type":"object"}}]}}},"$ref":"#/allOf/0/$defs/strictObject","properties":{"event":{"type":"string","const":"add_to_cart","description":"The name of the event indicating a add_to_cart has occurred."},"ecommerce":{"type":"object","description":"Ecommerce related data for the purchase event.","required":["currency","items"],"x-gtm-clear":true,"properties":{"value":{"type":"number","description":"The monetary value of the event. Set value to the sum of (price * quantity) for all items in items.","examples":[30.03,99.99,45.5]},"currency":{"type":"string","description":"The currency of the items in ISO 4217 three-letter format. Required when value is set.","examples":["USD","EUR","GBP"]},"items":{"type":"array","description":"The products added to the cart.","minItems":1,"items":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/components/product.json","title":"A Product","description":"A product object representing an item for use within a purchase event, based on Google Analytics 4 ecommerce event specifications.","type":"object","required":[],"properties":{"item_id":{"type":"string","description":"The ID of the item. Either item_id or item_name is required.","examples":["SKU_12345","PROD_98765"]},"item_name":{"type":"string","description":"The name of the item. Either item_id or item_name is required.","examples":["Stan and Friends Tee","Blue Running Shoes"]},"affiliation":{"type":"string","description":"A product affiliation to indicate a supplier or store. Note: affiliation is only available at the item level.","examples":["Google Merchandise Store","Nike Store"]},"coupon":{"type":"string","description":"The coupon name/code associated with the item. Coupon parameters at event and item levels are independent.","examples":["SUMMER_FUN","WELCOME20","SAVE10"]},"discount":{"type":"number","description":"The monetary value of the discount per unit applied to the item.","examples":[2.22,5,10.5]},"index":{"type":"number","description":"The index or position of the item in a list.","examples":[0,1,2]},"item_brand":{"type":"string","description":"The brand of the item.","examples":["Google","Nike","Adidas"]},"item_category":{"type":"string","description":"The category of the item. If used as part of a category hierarchy or taxonomy, this is the first category.","examples":["Apparel","Footwear","Electronics"]},"item_category2":{"type":"string","description":"The second category hierarchy or additional taxonomy of the item.","examples":["Adult","Women","Men"]},"item_category3":{"type":"string","description":"The third category hierarchy or additional taxonomy of the item.","examples":["Shirts","Shoes","Boots"]},"item_category4":{"type":"string","description":"The fourth category hierarchy or additional taxonomy of the item.","examples":["Crew","Running","Casual"]},"item_category5":{"type":"string","description":"The fifth category hierarchy or additional taxonomy of the item.","examples":["Short sleeve","Long distance","Lightweight"]},"item_list_id":{"type":"string","description":"The ID of the list in which the item was presented to the user. If set, item_list_id at the event level is ignored. If not set, item_list_id at the event level is used if available.","examples":["related_products","search_results","recommendations"]},"item_list_name":{"type":"string","description":"The name of the list in which the item was presented to the user. If set, item_list_name at the event level is ignored. If not set, item_list_name at the event level is used if available.","examples":["Related Products","Search Results","Recommended Items"]},"item_variant":{"type":"string","description":"The item variant or unique code or description for additional item details/options.","examples":["green","Blue Size 10","M-Black"]},"location_id":{"type":"string","description":"The physical location associated with the item, such as the location of a brick-and-mortar store. It is recommended to use the Google Place ID that corresponds to the associated item. A custom location ID can also be used. Note: location_id is only available at the item level.","examples":["ChIJIQBpAG2ahYAR_6128GcTUEo","store_123","location_sf"]},"price":{"type":"number","description":"The price of the item in the specified currency unit. If a discount is applied to the item, set price to the reduced per-unit price and provide the per-unit price discount in the discount parameter.","examples":[10.01,21.01,89.99]},"quantity":{"type":"number","description":"The item quantity. If not set, quantity is set to 1.","examples":[1,2,3]},"promotion_id":{"type":"string","description":"The ID of the promotion associated with the item.","examples":["P_12345","PROMO_001"]},"promotion_name":{"type":"string","description":"The name of the promotion associated with the item.","examples":["Summer Sale","Black Friday","Flash Deal"]},"creative_name":{"type":"string","description":"The name of the promotion creative.","examples":["summer_banner2","holiday_email_v1"]},"creative_slot":{"type":"string","description":"The name of the creative slot associated with the item.","examples":["featured_app_1","top_banner","sidebar"]},"google_business_vertical":{"type":"string","description":"The business vertical for the item (e.g., 'retail').","examples":["retail","ecommerce"]}}}}}},"user_data":{"type":"object","description":"User related data.","x-gtm-clear":true}}}}
|
|
24
24
|
|
|
25
25
|
/>
|
|
26
|
-
<SchemaJsonViewer
|
|
26
|
+
<SchemaJsonViewer
|
|
27
|
+
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/next/add-to-cart-event.json","title":"Add to Cart Event","description":"An add_to_cart event fires when a user adds one or more items to their shopping cart. Based on Google Analytics 4 ecommerce event specifications.","type":"object","allOf":[{"$ref":"./components/dataLayer.json"}],"properties":{"event":{"type":"string","const":"add_to_cart","description":"The name of the event indicating a add_to_cart has occurred."},"ecommerce":{"type":"object","description":"Ecommerce related data for the purchase event.","properties":{"value":{"type":"number","description":"The monetary value of the event. Set value to the sum of (price * quantity) for all items in items.","examples":[30.03,99.99,45.5]},"currency":{"type":"string","description":"The currency of the items in ISO 4217 three-letter format. Required when value is set.","examples":["USD","EUR","GBP"]},"items":{"type":"array","description":"The products added to the cart.","minItems":1,"items":{"$ref":"./components/product.json"}}},"required":["currency","items"]}}}}
|
|
28
|
+
sourcePath={"add-to-cart-event.json"}
|
|
29
|
+
schemaSources={{"add-to-cart-event.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/add-to-cart-event.json","title":"Add to Cart Event","description":"An add_to_cart event fires when a user adds one or more items to their shopping cart. Based on Google Analytics 4 ecommerce event specifications.","type":"object","allOf":[{"$ref":"./components/dataLayer.json"}],"properties":{"event":{"type":"string","const":"add_to_cart","description":"The name of the event indicating a add_to_cart has occurred."},"ecommerce":{"type":"object","description":"Ecommerce related data for the purchase event.","properties":{"value":{"type":"number","description":"The monetary value of the event. Set value to the sum of (price * quantity) for all items in items.","examples":[30.03,99.99,45.5]},"currency":{"type":"string","description":"The currency of the items in ISO 4217 three-letter format. Required when value is set.","examples":["USD","EUR","GBP"]},"items":{"type":"array","description":"The products added to the cart.","minItems":1,"items":{"$ref":"./components/product.json"}}},"required":["currency","items"]}}},"components/dataLayer.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/components/dataLayer.json","title":"dataLayer","description":"Schema for the object structure pushed to the dataLayer.","type":"object","allOf":[{"$ref":"#/$defs/strictObject"}],"properties":{"event":{"type":"string","description":"The name of the event."},"ecommerce":{"type":"object","description":"Ecommerce related data.","x-gtm-clear":true},"user_data":{"type":"object","description":"User related data.","x-gtm-clear":true}},"required":["event"],"$defs":{"strictObject":{"type":"object","propertyNames":{"maxLength":40,"pattern":"^[a-z0-9_]+$"},"additionalProperties":{"anyOf":[{"$ref":"#/$defs/strictObject"},{"type":"array","items":{"$ref":"#/$defs/strictObject"}},{"not":{"type":"object"}}]}}}},"components/product.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/components/product.json","title":"A Product","description":"A product object representing an item for use within a purchase event, based on Google Analytics 4 ecommerce event specifications.","type":"object","properties":{"item_id":{"type":"string","description":"The ID of the item. Either item_id or item_name is required.","examples":["SKU_12345","PROD_98765"]},"item_name":{"type":"string","description":"The name of the item. Either item_id or item_name is required.","examples":["Stan and Friends Tee","Blue Running Shoes"]},"affiliation":{"type":"string","description":"A product affiliation to indicate a supplier or store. Note: affiliation is only available at the item level.","examples":["Google Merchandise Store","Nike Store"]},"coupon":{"type":"string","description":"The coupon name/code associated with the item. Coupon parameters at event and item levels are independent.","examples":["SUMMER_FUN","WELCOME20","SAVE10"]},"discount":{"type":"number","description":"The monetary value of the discount per unit applied to the item.","examples":[2.22,5,10.5]},"index":{"type":"number","description":"The index or position of the item in a list.","examples":[0,1,2]},"item_brand":{"type":"string","description":"The brand of the item.","examples":["Google","Nike","Adidas"]},"item_category":{"type":"string","description":"The category of the item. If used as part of a category hierarchy or taxonomy, this is the first category.","examples":["Apparel","Footwear","Electronics"]},"item_category2":{"type":"string","description":"The second category hierarchy or additional taxonomy of the item.","examples":["Adult","Women","Men"]},"item_category3":{"type":"string","description":"The third category hierarchy or additional taxonomy of the item.","examples":["Shirts","Shoes","Boots"]},"item_category4":{"type":"string","description":"The fourth category hierarchy or additional taxonomy of the item.","examples":["Crew","Running","Casual"]},"item_category5":{"type":"string","description":"The fifth category hierarchy or additional taxonomy of the item.","examples":["Short sleeve","Long distance","Lightweight"]},"item_list_id":{"type":"string","description":"The ID of the list in which the item was presented to the user. If set, item_list_id at the event level is ignored. If not set, item_list_id at the event level is used if available.","examples":["related_products","search_results","recommendations"]},"item_list_name":{"type":"string","description":"The name of the list in which the item was presented to the user. If set, item_list_name at the event level is ignored. If not set, item_list_name at the event level is used if available.","examples":["Related Products","Search Results","Recommended Items"]},"item_variant":{"type":"string","description":"The item variant or unique code or description for additional item details/options.","examples":["green","Blue Size 10","M-Black"]},"location_id":{"type":"string","description":"The physical location associated with the item, such as the location of a brick-and-mortar store. It is recommended to use the Google Place ID that corresponds to the associated item. A custom location ID can also be used. Note: location_id is only available at the item level.","examples":["ChIJIQBpAG2ahYAR_6128GcTUEo","store_123","location_sf"]},"price":{"type":"number","description":"The price of the item in the specified currency unit. If a discount is applied to the item, set price to the reduced per-unit price and provide the per-unit price discount in the discount parameter.","examples":[10.01,21.01,89.99]},"quantity":{"type":"number","description":"The item quantity. If not set, quantity is set to 1.","examples":[1,2,3]},"promotion_id":{"type":"string","description":"The ID of the promotion associated with the item.","examples":["P_12345","PROMO_001"]},"promotion_name":{"type":"string","description":"The name of the promotion associated with the item.","examples":["Summer Sale","Black Friday","Flash Deal"]},"creative_name":{"type":"string","description":"The name of the promotion creative.","examples":["summer_banner2","holiday_email_v1"]},"creative_slot":{"type":"string","description":"The name of the creative slot associated with the item.","examples":["featured_app_1","top_banner","sidebar"]},"google_business_vertical":{"type":"string","description":"The business vertical for the item (e.g., 'retail').","examples":["retail","ecommerce"]}},"required":[]}}}
|
|
30
|
+
/>
|
|
27
31
|
|
|
28
32
|
|
|
29
33
|
"
|
|
@@ -52,7 +56,11 @@ An add_to_cart event fires when a user adds one or more items to their shopping
|
|
|
52
56
|
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/add-to-cart-event.json","title":"Add to Cart Event","description":"An add_to_cart event fires when a user adds one or more items to their shopping cart. Based on Google Analytics 4 ecommerce event specifications.","type":"object","required":["event"],"$defs":{"strictObject":{"type":"object","propertyNames":{"maxLength":40,"pattern":"^[a-z0-9_]+$"},"additionalProperties":{"anyOf":[{"$ref":"#/allOf/0/$defs/strictObject"},{"type":"array","items":{"$ref":"#/allOf/0/$defs/strictObject"}},{"not":{"type":"object"}}]}}},"$ref":"#/allOf/0/$defs/strictObject","properties":{"event":{"type":"string","const":"add_to_cart","description":"The name of the event indicating a add_to_cart has occurred."},"ecommerce":{"type":"object","description":"Ecommerce related data for the purchase event.","required":["currency","items"],"x-gtm-clear":true,"properties":{"value":{"type":"number","description":"The monetary value of the event. Set value to the sum of (price * quantity) for all items in items.","examples":[30.03,99.99,45.5]},"currency":{"type":"string","description":"The currency of the items in ISO 4217 three-letter format. Required when value is set.","examples":["USD","EUR","GBP"]},"items":{"type":"array","description":"The products added to the cart.","minItems":1,"items":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/components/product.json","title":"A Product","description":"A product object representing an item for use within a purchase event, based on Google Analytics 4 ecommerce event specifications.","type":"object","required":[],"properties":{"item_id":{"type":"string","description":"The ID of the item. Either item_id or item_name is required.","examples":["SKU_12345","PROD_98765"]},"item_name":{"type":"string","description":"The name of the item. Either item_id or item_name is required.","examples":["Stan and Friends Tee","Blue Running Shoes"]},"affiliation":{"type":"string","description":"A product affiliation to indicate a supplier or store. Note: affiliation is only available at the item level.","examples":["Google Merchandise Store","Nike Store"]},"coupon":{"type":"string","description":"The coupon name/code associated with the item. Coupon parameters at event and item levels are independent.","examples":["SUMMER_FUN","WELCOME20","SAVE10"]},"discount":{"type":"number","description":"The monetary value of the discount per unit applied to the item.","examples":[2.22,5,10.5]},"index":{"type":"number","description":"The index or position of the item in a list.","examples":[0,1,2]},"item_brand":{"type":"string","description":"The brand of the item.","examples":["Google","Nike","Adidas"]},"item_category":{"type":"string","description":"The category of the item. If used as part of a category hierarchy or taxonomy, this is the first category.","examples":["Apparel","Footwear","Electronics"]},"item_category2":{"type":"string","description":"The second category hierarchy or additional taxonomy of the item.","examples":["Adult","Women","Men"]},"item_category3":{"type":"string","description":"The third category hierarchy or additional taxonomy of the item.","examples":["Shirts","Shoes","Boots"]},"item_category4":{"type":"string","description":"The fourth category hierarchy or additional taxonomy of the item.","examples":["Crew","Running","Casual"]},"item_category5":{"type":"string","description":"The fifth category hierarchy or additional taxonomy of the item.","examples":["Short sleeve","Long distance","Lightweight"]},"item_list_id":{"type":"string","description":"The ID of the list in which the item was presented to the user. If set, item_list_id at the event level is ignored. If not set, item_list_id at the event level is used if available.","examples":["related_products","search_results","recommendations"]},"item_list_name":{"type":"string","description":"The name of the list in which the item was presented to the user. If set, item_list_name at the event level is ignored. If not set, item_list_name at the event level is used if available.","examples":["Related Products","Search Results","Recommended Items"]},"item_variant":{"type":"string","description":"The item variant or unique code or description for additional item details/options.","examples":["green","Blue Size 10","M-Black"]},"location_id":{"type":"string","description":"The physical location associated with the item, such as the location of a brick-and-mortar store. It is recommended to use the Google Place ID that corresponds to the associated item. A custom location ID can also be used. Note: location_id is only available at the item level.","examples":["ChIJIQBpAG2ahYAR_6128GcTUEo","store_123","location_sf"]},"price":{"type":"number","description":"The price of the item in the specified currency unit. If a discount is applied to the item, set price to the reduced per-unit price and provide the per-unit price discount in the discount parameter.","examples":[10.01,21.01,89.99]},"quantity":{"type":"number","description":"The item quantity. If not set, quantity is set to 1.","examples":[1,2,3]},"promotion_id":{"type":"string","description":"The ID of the promotion associated with the item.","examples":["P_12345","PROMO_001"]},"promotion_name":{"type":"string","description":"The name of the promotion associated with the item.","examples":["Summer Sale","Black Friday","Flash Deal"]},"creative_name":{"type":"string","description":"The name of the promotion creative.","examples":["summer_banner2","holiday_email_v1"]},"creative_slot":{"type":"string","description":"The name of the creative slot associated with the item.","examples":["featured_app_1","top_banner","sidebar"]},"google_business_vertical":{"type":"string","description":"The business vertical for the item (e.g., 'retail').","examples":["retail","ecommerce"]}}}}}},"user_data":{"type":"object","description":"User related data.","x-gtm-clear":true}}}}
|
|
53
57
|
|
|
54
58
|
/>
|
|
55
|
-
<SchemaJsonViewer
|
|
59
|
+
<SchemaJsonViewer
|
|
60
|
+
schema={{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/1.1.1/add-to-cart-event.json","title":"Add to Cart Event","description":"An add_to_cart event fires when a user adds one or more items to their shopping cart. Based on Google Analytics 4 ecommerce event specifications.","type":"object","allOf":[{"$ref":"./components/dataLayer.json"}],"properties":{"event":{"type":"string","const":"add_to_cart","description":"The name of the event indicating a add_to_cart has occurred."},"ecommerce":{"type":"object","description":"Ecommerce related data for the purchase event.","properties":{"value":{"type":"number","description":"The monetary value of the event. Set value to the sum of (price * quantity) for all items in items.","examples":[30.03,99.99,45.5]},"currency":{"type":"string","description":"The currency of the items in ISO 4217 three-letter format. Required when value is set.","examples":["USD","EUR","GBP"]},"items":{"type":"array","description":"The products added to the cart.","minItems":1,"items":{"$ref":"./components/product.json"}}},"required":["currency","items"]}}}}
|
|
61
|
+
sourcePath={"add-to-cart-event.json"}
|
|
62
|
+
schemaSources={{"add-to-cart-event.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/add-to-cart-event.json","title":"Add to Cart Event","description":"An add_to_cart event fires when a user adds one or more items to their shopping cart. Based on Google Analytics 4 ecommerce event specifications.","type":"object","allOf":[{"$ref":"./components/dataLayer.json"}],"properties":{"event":{"type":"string","const":"add_to_cart","description":"The name of the event indicating a add_to_cart has occurred."},"ecommerce":{"type":"object","description":"Ecommerce related data for the purchase event.","properties":{"value":{"type":"number","description":"The monetary value of the event. Set value to the sum of (price * quantity) for all items in items.","examples":[30.03,99.99,45.5]},"currency":{"type":"string","description":"The currency of the items in ISO 4217 three-letter format. Required when value is set.","examples":["USD","EUR","GBP"]},"items":{"type":"array","description":"The products added to the cart.","minItems":1,"items":{"$ref":"./components/product.json"}}},"required":["currency","items"]}}},"components/dataLayer.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/components/dataLayer.json","title":"dataLayer","description":"Schema for the object structure pushed to the dataLayer.","type":"object","allOf":[{"$ref":"#/$defs/strictObject"}],"properties":{"event":{"type":"string","description":"The name of the event."},"ecommerce":{"type":"object","description":"Ecommerce related data.","x-gtm-clear":true},"user_data":{"type":"object","description":"User related data.","x-gtm-clear":true}},"required":["event"],"$defs":{"strictObject":{"type":"object","propertyNames":{"maxLength":40,"pattern":"^[a-z0-9_]+$"},"additionalProperties":{"anyOf":[{"$ref":"#/$defs/strictObject"},{"type":"array","items":{"$ref":"#/$defs/strictObject"}},{"not":{"type":"object"}}]}}}},"components/product.json":{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://tracking-docs-demo.buchert.digital/schemas/components/product.json","title":"A Product","description":"A product object representing an item for use within a purchase event, based on Google Analytics 4 ecommerce event specifications.","type":"object","properties":{"item_id":{"type":"string","description":"The ID of the item. Either item_id or item_name is required.","examples":["SKU_12345","PROD_98765"]},"item_name":{"type":"string","description":"The name of the item. Either item_id or item_name is required.","examples":["Stan and Friends Tee","Blue Running Shoes"]},"affiliation":{"type":"string","description":"A product affiliation to indicate a supplier or store. Note: affiliation is only available at the item level.","examples":["Google Merchandise Store","Nike Store"]},"coupon":{"type":"string","description":"The coupon name/code associated with the item. Coupon parameters at event and item levels are independent.","examples":["SUMMER_FUN","WELCOME20","SAVE10"]},"discount":{"type":"number","description":"The monetary value of the discount per unit applied to the item.","examples":[2.22,5,10.5]},"index":{"type":"number","description":"The index or position of the item in a list.","examples":[0,1,2]},"item_brand":{"type":"string","description":"The brand of the item.","examples":["Google","Nike","Adidas"]},"item_category":{"type":"string","description":"The category of the item. If used as part of a category hierarchy or taxonomy, this is the first category.","examples":["Apparel","Footwear","Electronics"]},"item_category2":{"type":"string","description":"The second category hierarchy or additional taxonomy of the item.","examples":["Adult","Women","Men"]},"item_category3":{"type":"string","description":"The third category hierarchy or additional taxonomy of the item.","examples":["Shirts","Shoes","Boots"]},"item_category4":{"type":"string","description":"The fourth category hierarchy or additional taxonomy of the item.","examples":["Crew","Running","Casual"]},"item_category5":{"type":"string","description":"The fifth category hierarchy or additional taxonomy of the item.","examples":["Short sleeve","Long distance","Lightweight"]},"item_list_id":{"type":"string","description":"The ID of the list in which the item was presented to the user. If set, item_list_id at the event level is ignored. If not set, item_list_id at the event level is used if available.","examples":["related_products","search_results","recommendations"]},"item_list_name":{"type":"string","description":"The name of the list in which the item was presented to the user. If set, item_list_name at the event level is ignored. If not set, item_list_name at the event level is used if available.","examples":["Related Products","Search Results","Recommended Items"]},"item_variant":{"type":"string","description":"The item variant or unique code or description for additional item details/options.","examples":["green","Blue Size 10","M-Black"]},"location_id":{"type":"string","description":"The physical location associated with the item, such as the location of a brick-and-mortar store. It is recommended to use the Google Place ID that corresponds to the associated item. A custom location ID can also be used. Note: location_id is only available at the item level.","examples":["ChIJIQBpAG2ahYAR_6128GcTUEo","store_123","location_sf"]},"price":{"type":"number","description":"The price of the item in the specified currency unit. If a discount is applied to the item, set price to the reduced per-unit price and provide the per-unit price discount in the discount parameter.","examples":[10.01,21.01,89.99]},"quantity":{"type":"number","description":"The item quantity. If not set, quantity is set to 1.","examples":[1,2,3]},"promotion_id":{"type":"string","description":"The ID of the promotion associated with the item.","examples":["P_12345","PROMO_001"]},"promotion_name":{"type":"string","description":"The name of the promotion associated with the item.","examples":["Summer Sale","Black Friday","Flash Deal"]},"creative_name":{"type":"string","description":"The name of the promotion creative.","examples":["summer_banner2","holiday_email_v1"]},"creative_slot":{"type":"string","description":"The name of the creative slot associated with the item.","examples":["featured_app_1","top_banner","sidebar"]},"google_business_vertical":{"type":"string","description":"The business vertical for the item (e.g., 'retail').","examples":["retail","ecommerce"]}},"required":[]}}}
|
|
63
|
+
/>
|
|
56
64
|
|
|
57
65
|
|
|
58
66
|
"
|
|
@@ -147,4 +147,32 @@ describe('ConditionalRows', () => {
|
|
|
147
147
|
screen.getByText(JSON.stringify([{ name: 'postal_code' }])),
|
|
148
148
|
).toBeInTheDocument();
|
|
149
149
|
});
|
|
150
|
+
|
|
151
|
+
it('keeps conditional control rows neutral instead of zebra-striped', () => {
|
|
152
|
+
const { container, getByText } = render(
|
|
153
|
+
<table>
|
|
154
|
+
<tbody>
|
|
155
|
+
<ConditionalRows
|
|
156
|
+
row={conditionalRow}
|
|
157
|
+
stripeIndex={1}
|
|
158
|
+
stripeState={{ current: 2 }}
|
|
159
|
+
/>
|
|
160
|
+
</tbody>
|
|
161
|
+
</table>,
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
const ifRow = getByText('If').closest('tr');
|
|
165
|
+
const thenRow = getByText('Then').closest('tr');
|
|
166
|
+
const elseRow = getByText('Else').closest('tr');
|
|
167
|
+
|
|
168
|
+
expect(ifRow).toHaveClass('schema-row--control');
|
|
169
|
+
expect(thenRow).toHaveClass('schema-row--control');
|
|
170
|
+
expect(elseRow).toHaveClass('schema-row--control');
|
|
171
|
+
expect(ifRow).not.toHaveClass('schema-row--zebra-even');
|
|
172
|
+
expect(thenRow).not.toHaveClass('schema-row--zebra-even');
|
|
173
|
+
expect(elseRow).not.toHaveClass('schema-row--zebra-even');
|
|
174
|
+
expect(
|
|
175
|
+
container.querySelector('[data-testid="schema-rows"]'),
|
|
176
|
+
).toBeInTheDocument();
|
|
177
|
+
});
|
|
150
178
|
});
|