> 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
