Standard events
These are the events Tocadule expects your store to send. Each one has a canonical name, a set of properties, and a place in the funnel. This page lists every standard event with the exact script you can paste, when to fire it, and which fields are required versus optional.
All events go through the same tiny API on window.tocadule:
tocadule.track(name, props)— record an eventtocadule.cart(data)— set the full current cart (a snapshot, not an event)tocadule.identify(email, traits)— tell us who the visitor is (sign-up, login)tocadule.requestPush(cb)— prompt for web-push permission
Install once, then fire freely
The install block is a small async loader. A stub queues any track / identify /
cart / requestPush calls into window.tocadule._q; the real snippet.js loads
asynchronously and replays that queue on init. This is why your per-page event code
can run before the snippet has finished loading and nothing is lost.
<link rel="preconnect" href="https://app.tocadule.com">
<script>window.tocadule=window.tocadule||{};window.tocadule._q=window.tocadule._q||[];['track','identify','cart','requestPush','setConsent'].forEach(function(m){window.tocadule[m]=window.tocadule[m]||function(){window.tocadule._q.push([m,arguments])}});</script>
<script async fetchpriority="high" data-workspace="YOUR_WORKSPACE_ID" src="https://app.tocadule.com/snippet.js"></script>Paste the install block once, site-wide, in your theme header before any per-page
event code. The stub defines window.tocadule synchronously, so the samples below need
no guard: any track / cart / identify calls you make queue into _q and replay once
snippet.js finishes loading — nothing is lost, even on fast-parsing pages (cart,
order-success, sign-up). The failure mode to avoid is firing per-page calls without
the stub in the header: then window.tocadule is undefined when your code runs and the
call fails.
The code samples below come straight from the in-app scripts (the Data centre's install section).
Replace each {…} placeholder with your platform's token. Values sit in backticks, so a
quote in a value ("Levi's") never breaks the script. A token your page leaves unfilled
(still {…}) is no value: we drop it. A required field that does not arrive shows as
Eksik (missing) in the Data centre. Send money and counts as your store writes them:
the number format is set once per source.
Three kinds of events
| Kind | Events | Source |
|---|---|---|
| Always collected | page_view | The snippet, on every page |
| Your store's, or read from your pages | product_view, add_to_cart and the other store events; view_item_list, search, view_cart, checkout_started may instead come from your page views by page type | Your tocadule.track() code or your dataLayer; the four page-type events from the page addresses you set (the page door) |
| Sent by your store or platform | purchase, identify (sign-up, the logged-in line, the order page, the preference page), cart_state (your full cart), sign-up / lead forms, purchase_cancelled; Shopify checkout_abandoned / order_fulfilled | Your script, the Shopify app, the Server API (cancellations) or a CSV upload. purchase from the dataLayer is not supported yet. Shopify checkout_abandoned is written by Tocadule when a checkout has had no activity for 60 minutes and no purchase followed it; a checkout itself arrives as checkout_started. |
Each event has one road (where it comes from), chosen in the Data centre; it shows whether the event is arriving, and a copy from another road is kept apart, never counted twice.
Identity: only identity events carry customer details
Browsing events carry no email, phone or name. Customer details reach the contact
only through identify (and our popup forms, and your platform); anything personal on
another event is that event's ad match only. The ingest seam strips them before any
event row is stored.
| Event | Carries |
|---|---|
identify (sign-up; the one logged-in line in your common template; the order page, for every buyer) | email + profile traits + the marketing boxes ticked |
form events (sign_up, lead) | no email (the identify sent with it carries it); no permission fields |
purchase | the buyer: identify(email, …) right before it (then no email on the event); without identify, email / phone / names on the event for its ad match only |
A browser is linked to a contact only when the analytics lane allows it. Once linked, all of its events, including earlier ones, resolve to the contact, and forwards carry the contact's hashed email from then on (when the visitor allowed ads). See Identity & contacts.
Dedup, consent, and geo (how the data is handled)
- Dedup is automatic. Browser events dedup on
anonymous_id; external/webhook events dedup onsource_event_id. You never set a dedup id. - Consent has two independent lanes.
consent_state(analytics) gates keeping ananonymous_idand linking the browser to a contact.ad_consent(advertising) gates forwarding to ad destinations (fullwhen granted; otherwise nothing, or a count where the destination counts). Marketing permission is a separate record on the contact, not a CMP lane. - Location on events is resolved server-side from the real client IP (MaxMind,
offline). You don't send geo. A contact's profile location is declared-only — it
comes from
identify()traits, never inferred from IP.
product_view
Fire on a product detail page. Required: product_id. Everything else is optional
context.
<script>
// product_view: on your product page. Replace each {…} with your platform's token.
tocadule.track('product_view', { product_id: `{productId}`, variant_id: `{variantId}`,
sku: `{sku}`, name: `{productName}`, price: `{productPrice}`, discount: `{discount}`,
url: `{productUrl}`, image_url: `{productImage}`, brand: `{productBrand}`,
category: `{productCategory}`, currency: `{currency}` });
</script>view_item_list
Fire on a category / collection page. All fields optional.
<script>
// view_item_list: on your category or list page. Replace each {…} with your platform's token.
tocadule.track('view_item_list', { list_id: `{listId}`, list_name: `{listName}`,
list_url: window.location.href });
</script>view_cart
Fire when the visitor opens their cart page or drawer. All fields optional.
<script>
// view_cart: on your cart page. Replace each {…} with your platform's token.
var items = [];
// inside your platform's product loop, once per product:
items.push({ product_id: `{productId}`, variant_id: `{variantId}`, sku: `{sku}`, name: `{productName}`,
price: `{productPrice}`, quantity: `{productQuantity}`, url: `{productUrl}`, image_url: `{productImage}` });
tocadule.track('view_cart', { cart_id: `{cartId}`, cart_url: window.location.href,
subtotal: `{subtotal}`, discount: `{discount}`, tax: `{tax}`, total: `{total}`,
item_count: `{itemCount}`, currency: `{currency}`, coupon: `{coupon}`, items: items });
</script>add_to_cart
Fire when a product is added to the cart. Required: product_id.
add_to_cart is your store's own event (your script or your dataLayer): nothing is
derived from cart_state snapshots.
<script>
// add_to_cart: when a product is added. Replace each {…} with your platform's token.
tocadule.track('add_to_cart', { product_id: `{productId}`, variant_id: `{variantId}`,
sku: `{sku}`, name: `{productName}`, price: `{productPrice}`, discount: `{discount}`,
quantity: `{productQuantity}`, url: `{productUrl}`, image_url: `{productImage}`,
brand: `{productBrand}`, category: `{productCategory}`, currency: `{currency}` });
</script>cart_state
The source of truth for the cart. Cart segments, product-in-cart popups, cart
emails, and abandonment automations all read the latest cart_state, and
nothing is derived from it (add_to_cart is your own event). Send your whole current cart on every change
(add / remove / quantity) and on the cart page using tocadule.cart(…) — not track.
An empty cart is items: [].
Per item: product_id, name, price and quantity; variant_id, sku, url and
image_url make the cart cards richer. Top level: subtotal (the items after
discounts, VAT included, no shipping), currency, and your cart_id when you have one.
The cart has one source per store (Data centre › Cart): this call, or your platform.
cart_state is PII-free by design. Never put an email or other identifiers on
tocadule.cart() — it carries only cart contents plus the anonymous_id. Once the
shopper is identified, the cart resolves to their contact through the visitor id.
<script>
// cart: call on every cart change (add, remove, quantity) and on the cart page, with the WHOLE cart. Replace each {…} with your platform's token.
var items = [];
// inside your platform's cart loop, once per product:
items.push({ product_id: `{productId}`, variant_id: `{variantId}`, sku: `{sku}`, name: `{productName}`,
price: `{productPrice}`, quantity: `{productQuantity}`, url: `{productUrl}`, image_url: `{productImage}` });
tocadule.cart({ items: items, subtotal: `{subtotal}`, currency: `{currency}`, cart_id: `{cartId}` });
</script>On Shopify, IdeaSoft, T-Soft, and WooCommerce the cart is read automatically — you usually don't need this call. Use it on custom / headless stores or when the automatic reader can't see your cart.
checkout_started
Fire when the visitor reaches the checkout page with items in cart. All fields optional.
<script>
// checkout_started: on your checkout page. Replace each {…} with your platform's token.
var items = [];
// inside your platform's product loop, once per product:
items.push({ product_id: `{productId}`, variant_id: `{variantId}`, sku: `{sku}`, name: `{productName}`,
price: `{productPrice}`, quantity: `{productQuantity}`, url: `{productUrl}`, image_url: `{productImage}` });
tocadule.track('checkout_started', { subtotal: `{subtotal}`, discount: `{discount}`,
shipping: `{shipping}`, tax: `{tax}`, total: `{total}`, item_count: `{itemCount}`,
currency: `{currency}`, coupon: `{coupon}`, items: items });
</script>purchase
Put this on your order-success / thank-you page. Required: order_id and
total; a required field that does not arrive shows as Eksik (missing) in the
Data centre. items come from your platform's product loop. The order page
identifies every buyer: identify(email) right before the purchase writes the
contact and travels with the purchase in one request, so the purchase belongs to that
contact (a logged-in member's repeat is skipped: the snippet sends identify once per
browser + email per 30 days). Don't put the email on the event. If you don't call
identify (you don't want a person record), put the email on the event for its ad
match: it is never stored and creates no contact; ad platforms receive it hashed, only
when the visitor allowed ads. shipping, tax, discount and coupon are optional
extras.
A buyer who refused tracking: identify still writes the contact (your record), the browser is not linked, and the order is counted with the day's hash.
<script>
// purchase: on your order confirmation page. Replace each {…} with your platform's token.
var items = [];
// inside your platform's product loop, once per product:
items.push({ product_id: `{productId}`, variant_id: `{variantId}`, sku: `{sku}`, name: `{productName}`,
price: `{productPrice}`, quantity: `{productQuantity}`, url: `{productUrl}`, image_url: `{productImage}` });
tocadule.identify(`{email}`);
tocadule.track('purchase', { order_id: `{orderId}`, total: `{total}`, subtotal: `{subtotal}`,
shipping: `{shipping}`, tax: `{tax}`, discount: `{discount}`, coupon: `{coupon}`,
currency: `{currency}`, items: items });
</script>On Shopify, purchases arrive automatically from the orders/create webhook — you don't
need this script. Use it on non-Shopify stores.
purchase_cancelled
An order was cancelled, refunded, or rejected. It lowers revenue and ROAS by the
reversed amount. It's a back-office event: it never fires in a shopper's browser,
and tocadule.track('purchase_cancelled') is refused (a public page could otherwise
lower a store's revenue). It reaches us one of three ways:
- Shopify — automatic, via the
orders/cancelledandrefunds/createwebhooks. Nothing to add. - Any other platform — from your server, through the server API.
- No developer — upload your cancelled-orders export (CSV / Excel) to Toca, or just tell it the order numbers. It shows what it matched before writing anything.
Whichever way, the rules are the same: the order must be one we recorded a purchase
for (same order_id), and an order is reversed at most once — sending the same
cancellation twice, or through two ways, changes nothing. A partial refund is its own
row; a later cancellation reverses only what's left.
From your server
Send it to the server API with your API key:
curl -X POST https://api.tocadule.com/v1/events \
-H "Authorization: Bearer tdk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"event": "purchase_cancelled",
"properties": { "order_id": "1001", "reason": "cancelled" }
}'| Property | |
|---|---|
order_id | Required. The same order id your purchase sent. |
reason | cancelled (default) · rejected · refunded |
amount | The refunded money. Required when reason is refunded; a cancellation reverses the whole order by itself. |
refund_id | Optional — your refund's id, so a retried partial refund is counted once. |
The answer says what happened to it: written, or skipped with no_purchase (we never
recorded that order) or already_reversed (it was reversed before).
From Toca (no developer)
Export your cancelled / returned orders from your store's admin panel and attach the file
in Toca (CSV or Excel .xlsx, up to 5 MB) — or just type the order numbers ("1234 ve 1235
iptal oldu").
- Columns are found by their header words, in Turkish or English: the order number (sipariş no, order, order id), and optionally the status (durum, status) and the amount (tutar, amount, total). If Toca can't tell which column is the order number, it asks once.
- With a status column, only rows that read cancelled or refunded count (İptal edildi, İade edildi, cancelled, refunded, returned…). Without one, every row is a cancellation.
- Orders are matched by
order_idor the order number your purchase carried. - Toca shows what it found — matched (with the total), not matched, already reversed — and writes nothing until you approve the card.
- The file is stored privately (never on a public URL) and deleted after one day.
What it changes
- Revenue in Analytics, Home and Toca is net: each reversal comes off revenue on its own date (as GA4 does). A full reversal also takes the order off the order count. A Cancellations figure shows what was taken off.
- Attributed revenue — what a popup, campaign or automation brought — loses the reversed money from that order.
- Destinations: GA4 receives a
refund; the other ad platforms don't take reversals (see Destinations).
On Shopify, cancelling an order with a refund sends both orders/cancelled and
refunds/create. They count as one reversal.
identify
Call it when a shopper signs up or logs in. Required: email. On a sign-up form,
call it once, on submit, with the boxes the shopper ticked: without a permission
field the contact is created not subscribed. subscribed_<channel> is the only
permission field (true grants, false withdraws); a single "commercial electronic
messages" (ETK) box is sent as subscribed_email / subscribed_sms / subscribed_phone
true when ticked and left out when not. Any other box (consent_etk, consent_kvkk,
consent_terms, your own keys) is stored on the contact exactly as sent and never read
as marketing permission. identify's fields are the person, sent in traits under these
names: phone, first_name, last_name, city, region, postal_code, country,
birthday (YYYY-MM-DD), gender, customer_id (your own id for the customer) and
subscribed_email / subscribed_sms / subscribed_phone / subscribed_whatsapp. A trait with
another name is yours: map it once in the data centre (first_name ← traits.ad). country
and city unlock declared location segments.
<script>
// Your sign-up or login form (call once, on submit). Replace the selectors with
// your form's field names. Permission is read when the form is SUBMITTED, so it
// carries the boxes' final state. Without a permission field the contact is
// created NOT subscribed.
// marketing_opt_in one "commercial electronic messages" (ETK) box → subscribed_email /
// subscribed_sms / subscribed_phone true when ticked (or one box per channel)
// consent_etk, consent_kvkk, consent_terms: your own boxes, stored on the contact as sent, never marketing permission
(function(){
function val(s){ var el = document.querySelector(s); return el && el.value ? el.value.trim() : ''; }
// A box that is not on the page is left out (undefined), never sent as false.
function box(s){ var el = document.querySelector(s); return el ? !!el.checked : undefined; }
var last = '';
function send(){
var email = val('input[name="email"]');
if (email.indexOf('@') < 1) return;
var etk = box('input[name="marketing_opt_in"]');
var traits = {
first_name: val('input[name="first_name"]') || undefined,
last_name: val('input[name="last_name"]') || undefined,
phone: val('input[name="phone"]') || undefined,
// the ETK box ticked → one permission per channel; unticked → left out (not a withdrawal)
subscribed_email: etk || undefined,
subscribed_sms: etk || undefined,
subscribed_phone: etk || undefined,
consent_etk: etk,
consent_kvkk: box('input[name="kvkk"]'),
consent_terms: box('input[name="terms"]')
};
var key = email + JSON.stringify(traits);
if (key === last) return; // same submit twice: send once
last = key;
tocadule.identify(email, traits);
}
document.addEventListener('submit', function(e){
if (e.target && e.target.querySelector && e.target.querySelector('input[name="email"]')) send();
}, true);
})();
</script>On the pages where the shopper is logged in, one line links the browser (repeats are ignored; it never changes permission), so browsing events need no email:
<script>
var email = `{email}`;
if (email.indexOf('@') > 0 && email.indexOf('{') < 0) tocadule.identify(email);
</script>identify() never raises a consent lane: a refused visitor who signs up gets a contact,
but their browser is not linked to it.
The preference page
Your communication-preferences page is an identify call with the per-channel
permissions. Both "on" and "off" are recorded (an off is an unsubscribe); a checkbox
that is not on the page is left out.
<script>
(function(){
function box(s){ var el = document.querySelector(s); return el ? !!el.checked : undefined; }
document.addEventListener('submit', function(e){
var f = e.target;
if (!f || !f.querySelector || !f.querySelector('input[name="email_opt_in"]')) return;
var email = '{email}';
if (email.indexOf('@') < 1 || email.indexOf('{') >= 0) return;
tocadule.identify(email, {
subscribed_email: box('input[name="email_opt_in"]'),
subscribed_sms: box('input[name="sms_opt_in"]'),
subscribed_phone: box('input[name="phone_opt_in"]'),
subscribed_whatsapp: box('input[name="whatsapp_opt_in"]')
});
}, true);
})();
</script>search
Fire when the visitor runs a site search. Optional: search_term.
<script>
// search: on your search results page. Replace each {…} with your platform's token.
tocadule.track('search', { search_term: `{searchTerm}` });
</script>Optional standard events
GA4's standard names, for stores that have them; nothing breaks without them. Their templates are in the data centre (Events), like every event's.
| Event | When | Fields |
|---|---|---|
select_item | a product is clicked in a list | the product's fields; on its line list_id, list_name, index |
view_promotion / select_promotion | a promotion is shown / clicked | promotion_id, promotion_name, creative_name, creative_slot |
add_to_wishlist | a product is added to the wishlist | the product's fields |
share | a product or a page is shared | method, content_type, content_id |
add_shipping_info | shipping details are entered in checkout | items, subtotal, currency, shipping_tier, coupon |
add_payment_info | payment details are entered in checkout | items, subtotal, currency, payment_type, coupon |
A product line may also carry category2 … category5, list_id, list_name, index and
its own coupon (GA4's item_category2 …, item_list_id, item_list_name, index, coupon).
Custom events
tocadule.track() accepts any event name with any properties. Custom events are
stored verbatim in your event stream exactly as you send them, and they benefit from
the same handling as standard events — dedup on anonymous_id, consent, geo
enrichment, and the PII strip (a custom event carries no customer details; it resolves
to the contact through the visitor id once the shopper is identified).
What's different: a custom name is not part of the required event contract, so it does
not map to a standard funnel row or a built-in destination mapping (Meta / GA4), and
segment event conditions are built from the canonical names above. Use the standard
names whenever one fits — send custom events only for data the standard set doesn't
cover. Several forms of one kind are one standard event with a field naming the form
(tocadule.track('lead', { form: 'demo' })): see Custom events.