For the complete documentation index, see llms.txt. This page is also available as Markdown.

Add to cart

The following describes how add to cart tracking is done for Firework.

How to implement the "add_to_cart" tracking event

<script>
function onAddToCart() {
    window._fwn.analytics.addToCart({
        "order_id": "123456789",
        "currency": "USD",
        "subtotal": "40.00",
        "total_discounts": "5.00",
        "order_value": "50.00",
        "line_items": [{
                "sku": "TSHIRT-RED-M",
                "quantity": 2,
                "price": "15.00",
                "name": "Red T-shirt (M)"
            },
            {
                "sku": "BANANA",
                "quantity": 10,
                "price": "1.00",
                "name": "Organic Banana"
            }
        ]

    });
}

// Calls onAddToCart() whenever there is add to cart happening
</script>

Note: Please refer to the payload section for the required fields.

Last updated

Was this helpful?