Skip to content

Commit 73b7f61

Browse files
authored
fix(readme): correct attribute for purchases
We don't allow passing id's with underscore PR: #341 Refs: https://api.docs.topsort.com/api-reference/events/report-events#body-items-product-id
1 parent 882e033 commit 73b7f61

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,18 @@ To track purchases, you need to add the `data-ts-action="purchase"` attribute to
9999

100100
You also need to provide the details of the purchased items using the `data-ts-items` attribute. This attribute should contain a JSON string representing an array of purchased items. Each item object can have the following properties:
101101

102-
* `product_id`: The ID of the product.
102+
* `productId`: The ID of the product.
103103
* `quantity`: The quantity of the product purchased.
104104
* `price`: The price of the product.
105105
* `vendorId`: (Optional) The ID of the vendor.
106106

107107
```html
108108
<button
109109
data-ts-action="purchase"
110-
data-ts-items='[{"product_id": "product-123", "quantity": 1, "price": 2399}, {"product_id": "product-456", "quantity": 2, "price": 399, "vendorId": "vendor-abc"}]'
110+
data-ts-items='[{"productId": "product-123", "quantity": 1, "price": 2399}, {"productId": "product-456", "quantity": 2, "price": 399, "vendorId": "vendor-abc"}]'
111111
>
112112
Complete Purchase
113-
</button>
113+
</button onclick="return false;">
114114
```
115115

116116
**Note:** The attribute value must be a valid JSON string. Ensure that you properly escape any quotes within the string.

0 commit comments

Comments
 (0)