# Custom Events

> Track the custom analytics events for your app.

Sessions and page views are recorded for you. Custom events tell you whether people did the thing you care about — added to cart, booked, subscribed, finished.

> **Note:** Custom Events is available on the **Premium** plan and during your free trial. On other plans, the card shows an upgrade view instead.

## Where events show

Every custom event is counted in [App Analytics](https://help.twinr.dev/twinr-in-built-analytics/engagement), on the **Engagement** tab. You don't need Firebase for this.

If [Firebase Analytics](https://help.twinr.dev/native-integrations/firebase-analytics) is set up and switched on, each event also goes to your Firebase project.

## Track a webpage click

Open **Integrations → Analytics → Custom events**. The card sits next to Firebase Analytics.

![The Analytics section in Integrations with the Firebase Analytics and Custom events cards](https://help.twinr.dev/assets/analytics-custom-events-card.png)

To track a tap on something on your website — an **Add to Cart** button, a filter, a link — click **Create event** and fill in:

![The Create event dialog with Element's identifier, Event name and Add property](https://help.twinr.dev/assets/custom-events-create-dialog.png)

| Field | What to enter |
| --- | --- |
| **Element's identifier** | The class or id of the element to watch. |
| **Event name** | What the event is called. See [Event names](#event-names). |
| **Property key** & **Property value** | Optional extra detail recorded with the event. Click **Add property** for each pair. |

Click **Add event**, then **Save as draft**.

Find the identifier by opening your site in a desktop browser, right-clicking the element and choosing **Inspect** — the same method as the [cart counter](https://help.twinr.dev/navigation-bar-buttons/cart-button).

Properties are how you tell identical events apart. If your Add to Cart button carries the same identifier on listing and product pages, add `clicked_from` / `Product listing page` so the report shows which one customers use.

> **Warning:** This depends on your website's markup. If a theme update renames that class, the event stops recording — silently, with no error. Check your events after any theme change.

To change or remove an event, use **Edit event** or **Delete event** on its row, then **Save as draft**.

## Track taps on buttons and menu items

Navigation bar buttons and hamburger menu items can record their own taps. When adding or editing one, turn on **Track Click Event** and give the event a name. It needs the same plans as this card.

This works for every navigation bar button type — [Linker](https://help.twinr.dev/navigation-bar-buttons/linker-button), [Cart](https://help.twinr.dev/navigation-bar-buttons/cart-button), [Custom](https://help.twinr.dev/navigation-bar-buttons/custom-button), [Native Link Sharing](https://help.twinr.dev/navigation-bar-buttons/native-link-sharing), [Hamburger](https://help.twinr.dev/navigation-bar-buttons/hamburger-menu) and Multi Language — and for individual items inside a hamburger menu.

## From your own code

For something no click can capture — an order completing, a form validating, a video finishing — call the bridge function:

```javascript
twinr_firebase_analytics_event('event_id')
```

> **Warning:** The value you pass is an event **set up on this card**, not a name you invent. An id that has not been set up records nothing. See [What is the JS Bridge](https://help.twinr.dev/js-bridge/what-is-the-js-bridge).

To record events with any name straight from your website, use `twinr_track`. See [Track Custom Events](https://help.twinr.dev/twinr-in-built-analytics/track-custom-events).

## Event names

An event name starts with a letter, then letters, numbers or underscores, up to 40 characters. The card and the **Track Click Event** field don't accept other names.

A name that doesn't fit can't be tracked. If an existing event has one, the card shows a warning on its row. Edit the event and give it a new name.

Pick a convention and keep it. `add_to_cart` and `AddToCart` are two unrelated events, and you can't merge them afterwards. Lowercase with underscores is the usual choice. Name the action, not the element: `checkout_started` still makes sense after you redesign the button.

## If your plan changes

If your app moves to a plan without custom events, your app stops sending them, to Firebase and to App Analytics, once it restarts.

## Check it

Custom events don't record from Twinr Preview. Test with a real build. To watch events arrive, use **Recent events** on the App Analytics [Engagement](https://help.twinr.dev/twinr-in-built-analytics/engagement#recent-events) tab, or Firebase's **DebugView** if Firebase Analytics is set up.

Source: https://help.twinr.dev/native-integrations/custom-events
