> ## Documentation Index
> Fetch the complete documentation index at: https://docs.maqetin.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Events

> What an event is, how to name it, what it carries, and where to see it in the console.

An event is one thing a person did in your product: signed up, placed an order, finished a transfer. Maqetin takes two calls for data, and journeys can start on events. A [batch](https://docs.maqetin.com/api-reference/batch.md) sends up to 100 calls in one request; the JavaScript SDK batches them for you.

| Call | What it does | Reference |
| - | - | - |
| `identify` | Says who a person is and sets their traits. It creates or updates their profile. Always names `userId`, your own id for the person. | [Identify](https://docs.maqetin.com/api-reference/identify.md) |
| `track` | Records one event: its name and its properties. Names the person with `userId`, `anonymousId`, or both. | [Track](https://docs.maqetin.com/api-reference/track.md) |

Give every call a `messageId`. If you send the same call again with the same `messageId`, Maqetin stores it once. The SDK does this for you when it retries.

## Identified and anonymous events

A visitor who has not signed in has no `userId`. The SDK makes an `anonymousId`, keeps it in the browser's storage, and tags their events with it. When you call `identify` for that visitor, their earlier anonymous events join their profile ([Profiles](https://docs.maqetin.com/data/profiles.md) has the rules). Anonymous events alone make no contact.

```mermaid theme={null}
sequenceDiagram
  Browser->>Maqetin: track with anonymousId
  Note over Maqetin: Stored, no contact yet
  Browser->>Maqetin: identify with userId and the same anonymousId
  Maqetin->>Maqetin: Create or update the profile
  Maqetin->>Maqetin: Join the anonymous events to it
```

> [!WARNING]
>
> Call `reset()` in the SDK when a person logs out. Without it, the next person on the same browser is tracked as the previous one, and their events go on the previous person's profile.

## Name events

Name an event `object.action`, in lower case and in the past tense, such as `order.placed`. Maqetin accepts any name that is not empty, so the convention is yours to keep.

* Names are case-sensitive: `Order.Placed` and `order.placed` are two events. A journey or segment matches the exact name your app sends, so pick one spelling and keep it. A journey or segment can target a name of up to 200 characters; keep yours well under that.
* Ten objects (the part before the first dot) belong to Maqetin: `app`, `install`, `deeplink`, `screen`, `page`, `push`, `in_app`, `link`, `message` and `email`. Do not use them for your own events: the SDK sends `page.viewed` itself.

## Properties

`properties` is an object with the details of the event. Its values can be any JSON value: text, numbers, booleans, objects or lists. With no `properties`, the event has `{}`. An event cannot be changed after it lands, so send what you need in it. A property name cannot hold the character U+0000. Size limits are in [Track](https://docs.maqetin.com/api-reference/track.md) and [Batch](https://docs.maqetin.com/api-reference/batch.md).

```ts SDK theme={null}
mq.track('order.completed', { orderId: 'ord_1001', total: 49.9, currency: 'USD' });
```

```sh curl theme={null}
curl https://in.maqetin.com/v1/track -H 'Authorization: Bearer mq_live_…' -H 'Content-Type: application/json' \
  -d '{ "userId": "user_123", "event": "order.completed", "properties": { "orderId": "ord_1001", "total": 49.9, "currency": "USD" }, "channel": "rest" }'
```

## Context

`context` says where the call came from. The JavaScript SDK fills it; if you call the routes yourself, send only what you know, or leave it out. Most fields have a length limit, and a value over it makes the call a 400. Set `disableAutoCollection: true` in the SDK to leave these fields out; the [JavaScript SDK](https://docs.maqetin.com/sdk/javascript.md) page lists what it collects.

| Field | What it holds | How Maqetin uses it |
| - | - | - |
| `timezone`, `locale` | The browser's IANA time zone and language | Kept on the profile on an `identify`. A trait you send wins |
| `deviceId` | A random id the SDK keeps for the browser | On an `identify`, adds the browser to the profile's devices, with when it was last seen |
| `userAgent` | The browser's user-agent string | |
| `page` | The `url`, `path`, `referrer` and `title`, without the query string or the fragment | Shown under each event on the contact's **Activity** tab |
| `campaign` | `utm_source`, `utm_medium`, `utm_campaign`, `utm_term` and `utm_content`, as `source`, `medium`, `name`, `term` and `content` | Shown under each event on the contact's **Activity** tab |
| `library` | The name and version of the SDK | |

## Find your events in the console

In the console, open **Developers**, then the **Event names** tab.

| Part | What it shows |
| - | - |
| **Last event received** | When the last `track` call arrived, and how many arrived in the last hour |
| **Receiving events** | Shows while events arrive. These indicators count `track` calls only and can be 5 seconds behind |
| **Event names** | Every `track` name sent in the last 30 days, the most recently received first, up to 200, each with **Last received**. **Refresh** reads the list again |
| **Latest ingestions** | Select a name: its 50 newest events, with **Received**, **Who**, **Channel** and **Properties**. Open a row for its properties, event time and event id |

A refused call is never stored, so it never shows here. If a name is missing, check the exact spelling and case your app sends, and the answers your app got.

For one person's events, open their contact: the **Activity** tab lists them newest first, with the events from before they were identified ([Contacts](https://docs.maqetin.com/data/contacts.md)). The **Trait keys** tab next to **Event names** lists the traits your contacts can hold ([Profiles](https://docs.maqetin.com/data/profiles.md)).


## Related topics

- [Segments](https://docs.maqetin.com/data/segments.md)
- [Track](https://docs.maqetin.com/api-reference/track.md)
- [Quickstart](https://docs.maqetin.com/quickstart.md)
- [JavaScript SDK](https://docs.maqetin.com/sdk/javascript.md)
- [Errors](https://docs.maqetin.com/api-reference/errors.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.