> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/umbraco-engage/developers/analytics/client-side-events-and-additional-javascript-files/create-your-own-events.md).

# Create your own events

Learn how to create and add custom events to Umbraco Engage.

You can send custom client-side events to Umbraco Engage. An example could be tracking when a visitor clicks a specific button.

{% hint style="info" %}
Custom events require the Umbraco Engage Analytics script (`umbracoEngage.analytics.js`) to already be loaded on the page. See [Additional measurements with analytics scripts](/umbraco-engage/developers/analytics/client-side-events-and-additional-javascript-files/additional-measurements-with-the-analytics-scripts.md) for how to add it.
{% endhint %}

This is done by executing JavaScript using the following format:

```js
umbEngage("send", "event", "<Category name>", "<Action>", "<Label>");
```

## Example: Tracking a button click

Say you want to track how many visitors click a "Sign up" button on your page. Attach the event call to the button's click handler:

```js
var signUpButton = document.querySelector("#signUpButton");

if (signUpButton) {
  signUpButton.addEventListener("click", function () {
    umbEngage("send", "event", "Navigation", "Clicked", "Sign Up Button");
  });
}
```

This sends an event with the category "**Navigation**", the action "**Clicked**", and the label "**Sign Up Button**" every time a visitor clicks the button.

{% hint style="info" %}
Umbraco Engage also ships ready-made event scripts you can include, such as Google Analytics blocker detection. See [Google Analytics Blocker Detection](/umbraco-engage/developers/analytics/client-side-events-and-additional-javascript-files/google-analytics-blocker-detection.md) for an example using this same format.
{% endhint %}

You can track all these events in the **Events** report of the **Analytics** section.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.umbraco.com/umbraco-engage/developers/analytics/client-side-events-and-additional-javascript-files/create-your-own-events.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
