Events

Custom events measure important outcomes on a website: a completed purchase, sign-up, download, lead submission, successful search, or meaningful button click.

Events use the TypeUI Insights snippet already installed on the website. You do not create an event in Cloudflare or register its name in TypeUI first.

Track an event

Call the public helper after analytics consent:

Plain text
window.trackTypeUIEvent("signup");

Track a successful purchase with an optional numeric value and three-letter currency code:

Plain text
window.trackTypeUIEvent("purchase", {
  value: 49,
  currency: "USD",
});

Other useful examples:

Plain text
window.trackTypeUIEvent("pricing.cta_click");
window.trackTypeUIEvent("whitepaper_download");
window.trackTypeUIEvent("contact_form_success");

The helper returns true when the event is accepted or queued and false when it cannot be collected.

Track outcomes, not attempts

Send an event only after the action succeeds. For example, track purchase after the payment provider confirms the order, not when the visitor first presses the checkout button.

Plain text
async function completeSignup(formData) {
  const response = await createAccount(formData);

  if (response.ok) {
    window.trackTypeUIEvent("signup");
  }
}

This keeps the event count useful as a conversion metric.

Event names and values

Event names can contain letters, numbers, dots, underscores, colons, and dashes. Use stable names that describe the completed action.

The optional event object accepts:

FieldTypeDescription
valueNumberA finite numeric value associated with the event
currencyStringA three-letter ISO currency code such as USD or EUR

TypeUI Insights intentionally does not accept arbitrary event metadata. Do not place names, email addresses, order IDs, account IDs, typed text, or other personal data in an event name.

trackTypeUIEvent() does not collect an event before analytics consent. If consent is active but the external tracker is still loading, the installation snippet can queue a short burst of events and deliver them after the tracker is ready.

Withdrawing analytics consent clears pending events and disables further collection.

Analyze conversions

The Custom events card ranks the most frequent events and shows their count, associated user sessions, comparison change, and total monetary value when a currency is present.

Custom events are also included in:

  • SUMMARY.md as an AI-ready conversion table
  • CSV exports for the current period and comparison
  • The same global date range and analytics context as traffic, audience, campaigns, pages, and interaction data
Use this SUMMARY.md to explain our signup funnel. Compare signup events with sessions and landing pages, identify likely drop-off points from the journeys and heatmap data, and propose three measurable UI experiments.

Suggested event plan

Start with a small set of business outcomes:

GoalSuggested event
New account createdsignup
Purchase completedpurchase
Qualified lead submittedlead_submit
Important file downloadeddownload
Primary pricing CTA usedpricing.cta_click

Add an event when it answers a decision you plan to make. A short, consistent event list is easier to understand than tracking every interaction as a conversion.