LogSure

Events and goals

Anything that is not a pageview is a custom event: a signup, a download, a purchase. Every custom event is a goal on the app's dashboard, with its visitors, count, total value and conversion.

From the page

// A custom event (a goal), with properties and an optional value.
logsure.track('signup', { plan: 'pro' });
logsure.track('purchase', { plan: 'pro' }, 9.99);
Events whose name or properties hold an email address, an IP address or a User-Agent are refused. Keep personal data out of analytics; it belongs in the inbox and the waitlist.

From a click, without code

A click on an element with data-logsure-event, or anywhere inside one, sends that event, with properties from its data-logsure-prop-* attributes:

<button data-logsure-event="trial-click" data-logsure-prop-plan="pro">Start a free trial</button>

From a back-end

Servers call LogSure directly with the app's server key (Settings › Apps, then the app). Forward the visitor's IP address, User-Agent and country and the page URL, so the event counts for that visitor:

curl -sS -X POST 'https://logsure.example.com/_care/event' \
  -H "authorization: Bearer $LOGSURE_KEY" \
  -H 'content-type: application/json' \
  --data '{"app":"example-shop","name":"purchase","url":"https://shop.example/checkout","value":24,
           "ip":"203.0.113.7","userAgent":"Mozilla/5.0 …","country":"DE"}'

Without ip and userAgent the event still counts in the totals (pageviews, goals) but not in visitors, visits or devices. The address and User-Agent are used in memory for the daily visitor code and never stored. A back-end may also send ts, a time within the last 15 minutes of the current UTC day, and up to 25 events in one request as an array.

Never send the server key from a browser: requests with a key and an Origin are refused.

POST /_care/event/{name} takes the event's name in the path instead, which suits webhooks from other services. See the ingest API for every field.

Goals on the dashboard

An app's custom events: add-to-cart and purchase, each with visitors, events, the summed value and conversion.
An app's events, under its dashboard.

The dashboard's Goals card lists every custom event in the window with its visitors, count, summed value and conversion (visitors who sent it over all visitors). Clicking one filters the whole dashboard to visitors who sent it. The events page shows each event's properties and their values, and up to three events can be drawn on the dashboard's chart next to visitors and pageviews.

The same numbers are in the API (getEvent), the terminal (logsure events shop signup) and through MCP (get_event).