@grainql/analytics-web). The dashboard reads the template events by their fixed names. Every
block on this page uses Analytics Web. For a full React shop, read E-commerce store.
The funnel
Every property is optional. Each item in
items holds id, name, price, and quantity.
An item of purchase can also hold category. Every template method takes an options object
as the second argument. { flush: true } sends the event at once. The TypeScript types of the
package win over this table when they disagree. Read Template events.
Search
CalltrackSearch after the results arrive, so results holds the count.
Product view
There is no template method for a product view. Usetrack with one name for the whole site.
Add to cart and remove from cart
Send the unit price and the quantity of the change, not the cart total. When a visitor changes a quantity, sendadd_to_cart or remove_from_cart with the difference.
Checkout
CalltrackCheckout when the checkout starts. If the payment fails, call it again with
success: false and the errorMessage. Send the same orderId later in purchase.
Purchase
CalltrackPurchase one time per order, on the confirmation page, with { flush: true }. The
flush sends the event before the visitor leaves the page.
Where to see the results
A track shows every path from one event to another and where the visitors stop. Create a track fromproduct_viewed to purchase, or from add_to_cart to checkout. Read
Tracks.
A goal counts one event against a target for a period. Create a goal on purchase with a
monthly target. Read Mission Control.
Rules for the client
- Use the template methods for the five template events. Do not send
purchaseoradd_to_cartwithtrackunder a different name. The dashboard reads the fixed names. - Send
currencywith every price. A total without a currency cannot be compared with another total. - Send the same
orderIdincheckoutandpurchase. A query onorderIdthen returns both events of one order. - Send
purchaseone time per order. A page reload on the confirmation page must not send it again. - Pass
{ flush: true }totrackPurchaseand to the lasttrackCheckoutbefore a navigation. Without it, the batch timer can fire after the page unloads, and the event is lost. - Send
itemsoncheckoutandpurchase. A total alone does not show which products sell. - Send the price per unit and the quantity, not a line total. A line total hides the quantity.