Skip to content

Send data

Custom events

Track actions like signups or button clicks with one line of JavaScript. Events show up on your dashboard by name.

Best for
Developers
Prerequisites
The script installed, and access to add JavaScript to your pages.

Usage

Once the script loads, call pebble() with an event name and optional properties.

JavaScript
pebble("signup", { props: { plan: "pro" } })

pebble(name, { props, revenue })

nametextRequired
The event name. Names are case-sensitive, so use the same one everywhere: signup, not Signup on one page and sign-up on another.
propsobject of text or numbers
Custom properties, such as plan: "pro". The dashboard breaks down the event by each value. Can't contain personal data.
revenue{ amount, currency }
Revenue amount with an ISO currency code, such as EUR. Currencies aren't converted.

Example

Track a signup when the button is clicked, with the selected plan.

HTMLYour page
<button id="start">Start your free month</button>

<script>
  document.getElementById("start").addEventListener("click", () => {
    pebble("signup", { props: { plan: "pro" } })
  })
</script>

Track a purchase with revenue:

JavaScript
pebble("order paid", { revenue: { amount: 49.00, currency: "EUR" } })

Good to know

Find your events on the dashboard under Goals, then Events.