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

# Monita Collect

> Learn how to send events directly to Monita based on custom javascript execution

You many want to want to send a custom event to Monita based on a user action or other condition that is not associated with a server call made by the vendor.

### Instructions

1. [Configure Global Monitoring](/monitoring/setup-global-monitoring)

2. Choose a vendor you want to send events for. You may create your own custom vendor

3. Enable Monita collect
   <img src="https://mintcdn.com/monita/9ogF6z6ScgRhVl-N/images/monitoring/global-monitoring-monita-collect-switch.png?fit=max&auto=format&n=9ogF6z6ScgRhVl-N&q=85&s=b02563d43df08d6bb6640ec4a84f49a2" alt="Enable Monita Collect" width="228" height="58" data-path="images/monitoring/global-monitoring-monita-collect-switch.png" />

4. <p>Open Vendor code detail panel by clicking on code <Icon icon="code-simple" iconType="solid" /></p>
   <img src="https://mintcdn.com/monita/9ogF6z6ScgRhVl-N/images/monitoring/global-monitoring-expand-code-detail-panel.png?fit=max&auto=format&n=9ogF6z6ScgRhVl-N&q=85&s=5b210c14c891ea5a907319c59ed41e03" alt="Open vendor code detail pane" width="376" height="222" data-path="images/monitoring/global-monitoring-expand-code-detail-panel.png" />

5. Copy code example
   <img src="https://mintcdn.com/monita/9ogF6z6ScgRhVl-N/images/monitoring/global-monitoring-vendor-code-detail-pane.png?fit=max&auto=format&n=9ogF6z6ScgRhVl-N&q=85&s=9b49e063a10dd347b77c567589f78607" alt="copy code" width="1261" height="358" data-path="images/monitoring/global-monitoring-vendor-code-detail-pane.png" />

6. Paste and modify the code in your website Javascript code
   <Tip>If you want to keep track of certain variables, call monita collect `monitaSendBeacon(...)` at the same spot inthe code the variables are set before being processed.</Tip>
   <img src="https://mintcdn.com/monita/9ogF6z6ScgRhVl-N/images/monitoring/global-monitoring-monita-collect-code-example.png?fit=max&auto=format&n=9ogF6z6ScgRhVl-N&q=85&s=3854fdcee826a0700087205001a811bd" alt="Enable Monita Collect" width="946" height="370" data-path="images/monitoring/global-monitoring-monita-collect-code-example.png" />

7. Test execution

If you have successfully send data to Monita from the client, you should see a network call on the Network tab in your browser (filter for v1/) and it should be visible in the platform visualisation dashboard.

<img src="https://mintcdn.com/monita/9ogF6z6ScgRhVl-N/images/monitoring/global-monitoring-monita-collect-call-check.png?fit=max&auto=format&n=9ogF6z6ScgRhVl-N&q=85&s=8b0cb3d1402c39f7f4d75c3667beea9d" alt="Check Monita Collect traffic" width="860" height="497" data-path="images/monitoring/global-monitoring-monita-collect-call-check.png" />

#### Sending custom data to Monita

If you want to send any arbitrary event and data to Monita, you can use 'Monita' as the Vendor (or even add your own custom Vendor in the UI.)
See a sample code snippet below:

<Info>The monitaSendBeacon function will work so long as the Monita Global JS SDK has been initialised on the page. If not, it should be loaded. To check if it has been loaded you can try and access `__monita_settings`, if it is available then Monita has been loaded. If not you can manually add our initialisation script with your token [as per this guide.](/documentation/monitoring/setup-global-monitoring#checking-that-monita-script-is-being-loaded-on-the-client-side-your-domain) </Info>

```javascript theme={null}
<script>
  // This simple example assumes the Monita SDK is already loaded on the page.
  monitaSendBeacon("Monita", "customEvent", {
    // Add any additional data such as data layer keys you want to send below:
    // url: window.location.href,
    // path: window.location.pathname,
    // userId: 'user123',
    // pageCategory: 'landing'
  });
</script>
```
