This event marks adding a product to the shopping cart
Using the Tweakwise JS implementation?This event is automatically included when you're using a button with the 'twn.add-to-cart' event on the Tweakwise product tiles.
In all other scenarios, you'll have to implement it manually. (i.e. product detail page)
How to implement?
<!-- INSTANCE_KEY SESSION_KEY AND PROFILE_KEY are inherited from the base tag -->
<script>
tweakwiseLayer.push({
event: 'addtocart',
data: {
productKey: 'ARTICLE_NUMBER',
quantity: QUANTITY,
totalAmount: TOTAL_AMOUNT
}
});
</script>curl --request POST \
--url 'https://navigator-analytics.tweakwise.com/api/addtocart?instanceKey=INSTANCE_KEY' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"ProfileKey": "PROFILE_KEY",
"SessionKey": "SESSION_KEY",
"ProductKey": "ITEM_ID",
"Quantity": "QUANTITY",
"TotalAmount": "TOTAL_AMOUNT"
}
'Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| INSTANCE_KEY | URL-parameter - text | yes | Your Tweakwise Instance Key |
| PROFILE_KEY | Body parameter - text | yes | The ID that identifies the current visitor. Read more about the profile key here |
SESSION_KEY | Body parameter - text | yes | The session key for the specific user. This can be your own session key, GA session. As long as it's consistent over the user's session. Allowed characters: alphanumeric and hyphens |
ITEM_ID | Body parameter - text | yes | The Tweakwise item ID of the current product |
| QUANTITY | Body parameter - number | yes | Amount of items of the product that's added to the cart |
| TOTAL_AMOUNT | Body parameter - decimal | yes | Total amount of the products added to the cart |
When do I submit this event?
Submit this event when adding a product to the shopping cart
Where do I implement this event in the code?
On every page where you are able to add a product to the shopping cart
How to handle event-specific warnings from Tweakwise
SessionKey: xx% missing / ProfileKey: xx% missing / ProductKey: xx% missing / Quantity: xx% missing / TotalAmount: xx% missing
Mismatched sessionkeys in this event and SessionStart (xx%)
Please share your findings with your implementation partner. If they have questions about these messages, please have them contact [email protected]
