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

# Use Autocapture

> Enable autocapture in the JavaScript SDK to automatically collect events, with custom configs to tune what gets captured

Starting with SDK version 2.60.0, the Javascript SDK can autocapture events when you enable it. To do so, enable the autocapture configuration:

```javascript theme={"system"}
// create an instance of the Mixpanel object
mixpanel.init('YOUR_PROJECT_TOKEN', {
    autocapture: true,    // enable autocapture
});
```

> [!WARNING]
>
> **EU and India data residency:** If your project uses EU or India data residency, you must explicitly set the API host in your init code: add `api_host: 'https://api-eu.mixpanel.com'` (EU) or `api_host: 'https://api-in.mixpanel.com'` (India) to `mixpanel.init()`. Otherwise, your data, including autocaptured events, will be dropped. If you send data through a proxy or custom domain, point it at your region's host instead and keep the proxy URL in your init code. See [EU Data Residency](https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript#eu-data-residency) and [India Data Residency](https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript#india-data-residency).

If you'd like to change the default Autocapture settings, you can use custom configs. These are the default configs:

```javascript theme={"system"}
mixpanel.init('YOUR_PROJECT_TOKEN', {
  autocapture: {
    pageview: "full-url",
    click: true,    
    input: true,
    rage_click: true,
    dead_click: true,
    scroll: true,
    submit: true,
    capture_text_content: false,
  },
});
```

[You can read more about custom configuration of Autocapture here](https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript).


## Related topics

- [Autocapture](https://docs.mixpanel.com/docs/tracking-methods/autocapture.md)
- [Tracking Events](https://docs.mixpanel.com/docs/overview/capture-events/track-events.md)
- [Mixpanel SDKs: Javascript](https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript.md)
