Custom events

Custom events

Tocadule ships with a set of standard commerce events (product_view, add_to_cart, checkout_started, purchase, …). But tocadule.track() accepts any event name you want. If you have a behaviour that matters to your store — wishlist_added, size_guide_opened, filter_applied, gift_message_written — you can send it, and Tocadule stores it, counts it, and lets you drill into it.

This page explains exactly what happens to a non-standard event once you fire it, and where it shows up in the dashboard so you can confirm it arrived.

tocadule.track('size_guide_opened', {
  product_id: 'SKU-102',
  category: 'shoes'
})

Prerequisite: the install stub

tocadule.track() only works once the tracking object exists on the page. The snippet loads asynchronously, so any inline call that runs before it finishes would be lost — unless you install the tiny stub loader in your site-wide <head>. The stub queues every track / identify / cart / requestPush call into window.tocadule._q and the real snippet replays the queue in order once it boots.

<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>
⚠️

Install the stub — don't rely on the raw async snippet on its own. Without the stub, window.tocadule doesn't exist until snippet.js finishes loading, so an inline tocadule.track(...) that runs first either throws (if it's unguarded) or is silently skipped by an if (window.tocadule) guard. The stub defines window.tocadule synchronously, so once it's in your <head> every call — guarded or not — is queued into _q and replayed in order. Tocadule's standard event scripts carry no guard: with the stub installed, tocadule always exists.

Naming rules

  • tocadule.track(name, props) accepts any string as the event name — there is no server-side allow-list on the track path. The request only needs a workspace and an event name to be stored.
  • Convention: use snake_case (lowercase letters, digits, underscores). It keeps your event catalog readable and matches the standard event names. Tocadule's no-code Event Rules builder enforces snake_case; hand-written track() calls are not forced to, but you should follow it anyway.
  • Event names are case-sensitive and matched exactly. Size_Guide and size_guide become two separate rows in your catalog — pick one spelling and stick to it.

Several forms of one kind: one event with a field

Several lead forms on one site (contact page, demo request, newsletter, footer) are one lead event with a field that names the form, not one custom event per form:

tocadule.track('lead', { form: 'iletisim' }) // or 'demo', 'bulten', 'footer'

Every form then counts as Lead, and Reports and Toca split the leads by form (your own field, kept as you send it). A form that means something else uses its own standard event (contact, submit_application, schedule). If your store already sends its own event name for a form, you can map that name onto one of ours in the Data centre instead (one store name per event): its rows count as that event.

What Tocadule does with a custom event

When a custom event arrives at /events/track, it goes through the same ingestion pipeline as a standard event. Nothing is thrown away for being non-canonical — the event_name is stored verbatim. Concretely, for every event:

StepWhat happens
StoredA row is written to the events table with your exact event_name and the properties JSON you sent.
Contact resolutionIf the visitor's anonymous_id is linked to a contact (through identify() or a popup form, when the analytics lane allows), the event resolves to that contact, including events sent before the link.
PII stripEmail, phone, names, addresses, national id, birth date and user_data are removed before the row is stored; an email-shaped value in the page address becomes redacted.
Geo enrichmentCountry / region / city / postal / timezone are resolved from the request IP (MaxMind, offline) (your own values win); postal code and timezone only with a granted lane; no coordinates.
Auto-attached propsThe snippet automatically adds UTM params, device / browser / OS, traffic source, page locale, and ad click IDs (gclid, gbraid, fbclid, …) to every event before it's sent.
ConsentBoth consent lanes are recorded on the row: consent_state (analytics) and ad_consent (advertising).
Bot flagThe user agent is checked; bot traffic is stored with is_bot = true and excluded from analytics by default.
DedupBrowser events dedup on anonymous_id; external/webhook events on source_event_id. You never set these yourself.

A custom event carries no customer details. Identify the shopper once with identify() (sign-up, the logged-in line in your common template, the order page, for every buyer); every event from that browser then resolves to the contact, and forwards carry the contact's hashed email when the visitor allowed ads. See Identity & contacts.

Canonical mapping vs. passthrough

Tocadule keeps a fixed set of standard event names (the standard events). Event names are matched exactly — nothing is renamed or mapped when an event arrives, segment event conditions match the exact name you pick, and a destination forwards an event only if one of its rules names it exactly. Send the standard names as written; any other name is stored as a custom event.

The Shopify connector writes the standard names for you (an orders/create webhook is stored as purchase), and a destination's suggested rules start from the standard names. A few read-side roll-ups still count common spellings of a standard event on its row (for example the per-event counts on the Events page, or revenue in Analytics) — that is counting, not mapping: the stored name never changes, and segments and forwarding still need the exact name.

  • A standard event feeds the standard funnel, gap-fill measurement, and the suggested ad-destination forwarding rules.
  • A custom event has no standard name. It is stored as-is. It is fully queryable, but it is not folded into the canonical Data Collection funnel, it is not part of the commerce gap-fill counters, and it is not forwarded to Meta / TikTok / Google unless you explicitly add it to a destination's forward list.

In short: standard events get the built-in commerce machinery for free; custom events are stored, counted, and available for you to build on, but you opt them into forwarding and funnels yourself.

Where custom events show up

Once you fire a custom event, you can confirm it landed and inspect it in the dashboard:

  • Events feed — the most recent events across your workspace, newest first, each with its event_name, properties, contact, and timestamp. Your custom event appears here within seconds of firing.
  • Event catalog — a per-event summary (over the last 30 days) with total fires, unique contacts, and last-fired time. Every distinct event name you've sent — standard or custom — has a row here. This is the fastest way to verify a new event is arriving and how often.
  • Event drill-in — filter the feed by a single event_name to see the raw rows and the exact property keys/values each one carried. Use this to confirm your properties payload is shaped the way you expect.
  • Property inspector — for any event name, Tocadule lists the distinct property keys (and sample values) it has seen in the last 30 days, so you can see which fields your custom event is actually delivering.

In the Data centre, custom events are listed read-only below the standard events we expect (which have a status and a source). Use the Events feed / catalog to find and verify custom events.

Example: a fully-shaped custom event

Custom events use the same track() signature and the same short form as the standard ones: each value in backticks, as your platform renders it (a token your page leaves unfilled, still {…}, is no value and is dropped):

<script>
  // wishlist_added: Replace each {…} with your platform's token.
  tocadule.track('wishlist_added', { product_id: `{productId}`, name: `{productName}`,
    price: `{productPrice}`, currency: `{currency}` });
</script>

Firing events without code (Event Rules)

If you can't add script to a page, you can create custom events from Tocadule's no-code Event Rules. A rule watches for a URL match, an element click, a form submit, or a custom JS event, and fires an event name you choose with properties pulled from the page (static values, CSS selectors, form fields, URL params, or cookies).

Event Rules require the event name to be snake_case, and each rule has a Test action that fires a synthetic event so you can confirm it lands in your Events feed before wiring it to the real trigger condition.

Good to know

  • No schema to declare. You don't register custom events ahead of time — the first time you fire one, its row appears in the catalog.
  • Properties are free-form JSON. Send whatever scalar fields are useful. For product cards, these product fields are read without extra mapping: product_name/name/title, product_price/price, product_image_url/image_url/image, product_url/url/link, product_id/id. Any other key can be mapped once in Settings › Data › Product cards.
  • Keep PII off events. tocadule.cart() and every track() event are stored without customer details. Customer details go on identify() (an event called right after it belongs to that contact). An email on an event is that event's ad match only: if you call identify, don't put it on the event.