Docs menu

Events and goals

Pageviews are automatic. Track anything else with one call.

Updated 21 Oct 2026

Track an event

Call atrby.track() when something happens that isn't a page load: a sign-up click, a demo request, a file download.

Browser
document.querySelector("#signup").addEventListener("click", () => {
  window.atrby?.track("signup_clicked");
});

Use atrby.goal() the same way for the actions you report on as conversions. Both count toward a goal with the same name, so the choice only affects how the event is labelled in a visit's timeline.

Browser
window.atrby?.goal("trial_started");
NameTypeRequiredDescription
namestringRequiredThe event name. Up to 128 characters; longer names are cut. Use lowercase with underscores so goals are easy to match.
propsobjectOptionalAccepted but not stored yet. Only the name is kept.
Properties aren't stored yet
Pass the detail you need in the name instead, for example plan_selected_growth. Each event still carries the page, source, country and device of the visit.

Clicks without code

Add data-autocapture="true" to the script tag to record clicks on links, buttons and any element with a data-atrby attribute. They arrive as an event named click. The clicked text and link aren't stored.

Turn events into goals

In the app, open Goals and choose “An event fires” with the event name, or “A page is viewed” with a path. Goals work on past data too, so you can add one after the fact. See goals and funnels.

Revenue in the browser

atrby.revenue(49, { currency: "EUR" }) records a payment from the browser. It counts in the Overview revenue total, but it isn't matched like a processor payment and doesn't appear on the Revenue screen. For real attribution, connect your processor or use the Payment API.

Was this helpful?
Ask a question about this page