# Track Events

URL: https://pieowl.com/docs/get-started/track-events



Events are the core of Pieowl. An event records one action a user takes, like clicking a button, sending a form or buying something.

The examples below use `pieowl`, the SDK instance you created during [install](/docs/get-started/install-pieowl). With the script tag, use `window.pieowl` instead. It works once `pieowl.js` has loaded; to call it earlier, use the `window.pieowl('track', ...)` form and add the [queue line](/docs/sdks/script#calling-pieowl-before-the-script-loads) before the script tag.

Tracking an event [#tracking-an-event]

Call `track` with an event name.

```javascript
pieowl.track('button_clicked');
```

With the script tag:

```javascript
window.pieowl('track', 'button_clicked');
```

Adding properties [#adding-properties]

Pass a properties object to add context to the event.

```javascript
pieowl.track('signup_button_clicked', {
  location: 'header',
  color: 'blue',
  variant: 'primary'
});
```

Common property types [#common-property-types]

* **Strings**: Text values like names, categories or IDs.
* **Numbers**: Numeric values like price, quantity or score.
* **Booleans**: True or false values.

Using data attributes [#using-data-attributes]

You can track clicks without writing JavaScript. Add a `data-track` attribute to a button or link. This needs **Clicks you marked in your code** to be on in Settings → Site (it is by default).

```html
<button 
  data-track="signup_clicked" 
  data-location="header"
>
  Sign Up
</button>
```

When a user clicks this button, Pieowl tracks a `signup_clicked` event with the property `location: 'header'`. Every other `data-*` attribute on the element becomes a property, with its name in camelCase (`data-plan-name` becomes `planName`).
