
Amplitude's [Autocapture](/docs/data/autocapture) is the fastest way to get up and running. This document helps you enable Autocapture across your digital products for default analytics with minimal engineering.

## Autocapture for the web

Starting with version 2.10.0, the Amplitude Browser SDK includes Autocapture to help you capture events, interactions, and attribution on your site.

### Install the Browser SDK

{% tabs tabs="Script Loader, npm, yarn" %}
{% tab name="Script Loader" %}
{% get-data-flowing-snippet /%}
{% /tab %}
{% tab name="npm" %}

```bash
npm install @amplitude/analytics-browser
```

{% /tab %}
{% tab name="yarn" %}

```bash
yarn add @amplitude/analytics-browser
```

{% /tab %}
{% /tabs %}

### Initialize the SDK

Browser SDK 2.10.0 and above includes element click and change tracking, which enables [visual labeling](/docs/data/visual-labeling) within Amplitude. To enable it, set `config.autocapture.elementInteractions` to `true` when you initialize the SDK.

{% tabs tabs="Script loader, npm / yarn" %}
{% tab name="Script loader" %}
No extra initialization required.
{% /tab %}
{% tab name="npm / yarn" %}

```js
import * as amplitude from "@amplitude/analytics-browser";
import { autocapturePlugin } from "@amplitude/plugin-autocapture-browser";

amplitude.init("AMPLITUDE_API_KEY", {
  autocapture: {
    elementInteractions: true,
    webVitals: true, // Enable Core Web Vitals tracking
  },
});
```

{% /tab %}
{% /tabs %}

### Content security policy (CSP)

If your web app configures a strict Content Security Policy (CSP), adjust the policy to allowlist Amplitude domains:

- Add `https://*.amplitude.com` to `script-src`.
- Add `https://*.amplitude.com` to `connect-src`.

### Events

| Event           | Description                                                                                    | Properties                                                                                                                                                                                                                                                                |
| --------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Page viewed     | Captures when a user loads a page on your site.                                                | Page counter, Page domain, Page location, Page path, Page title, Page URL, Session Replay ID (if enabled), Referrer, [Attribution](#marketing-attribution), [User properties](#user-properties).                                                                          |
| Start session   | Captures when a user starts a session on your site.                                            | Session Replay ID (if enabled), [User properties](#user-properties).                                                                                                                                                                                                      |
| End session     | Captures when a user ends a session on your site.                                              | [User properties](#user-properties).                                                                                                                                                                                                                                      |
| Form started    | Captures when a user interacts with a form on your site.                                       | Form destination, Session Replay ID (if enabled), [User properties](#user-properties).                                                                                                                                                                                    |
| Form submitted  | Captures when a user submits a form on your site.                                              | Form destination, Session Replay ID (if enabled), [User properties](#user-properties).                                                                                                                                                                                    |
| File downloaded | Captures when a user downloads a file from your site.                                          | File extension, File name, Link text, Link URL, Session Replay ID (if enabled),                                                                                                                                                                                           |
| Element clicked | Captures when a user clicks an element on the page.                                            | Element Aria Label, Element Class, Element Hierarchy, Element Href, Element ID, Element Parent Label, Element Position Left, Element Position Top, Element Selector, Element Tag, Element Text, Page Title, Page URL, Session Replay ID, Viewport Height, Viewport Width. |
| Element changed | Captures form element interactions, such as changes a dropdown or inputs text into a text box. | Element Class, Element Hierarchy, Element ID, Element Parent Label, Element Position Left, Element Position Top, Element Tag, Page Title, Page URL, Session Replay ID, Viewport Height, Viewport Width.                                                                   |
| Network request | Captures when the application makes a network request.                                         | URL, Request method, Status code, Duration, Request body size, Response body size, Session Replay ID (if enabled).                                                                                                                                                        |
| Web vitals      | Captures Core Web Vitals performance metrics when the browser tab becomes hidden.              | Page domain, Page location, Page path, Page title, Page URL, LCP, FCP, INP, CLS, TTFB metrics with performance ratings and timing data.                                                                                                                                   |

For more information, refer to Autocapture in the [Browser SDK 2](/docs/sdks/analytics/browser/browser-sdk-2#autocapture) documentation.

{% callout type="tip" heading="Default event prefix" %}
Amplitude prefixes Autocapture events with the Amplitude logo.
{% /callout %}

### Marketing attribution

Captures the following properties:

- UTM parameters (`utm_source`, `utm_medium`, `utm_campaign`, `utm_term`, `utm_content`).
- Referrer parameters (`referrer`, `referring_domain`).
- Click identifiers for Google, Facebook, Kochava, Microsoft, TikTok, X (Twitter), LinkedIn, and Reddit.
- [First-touch](/docs/sdks/analytics/browser/browser-sdk-2#first-touch-attribution) and [multi-touch](/docs/sdks/analytics/browser/browser-sdk-2#multi-touch-attribution) attribution. For more information about attribution, refer to [Use sessions, channels, and attribution to drive marketing analytics](/docs/analytics/marketing-analytics).

### User properties

Amplitude attaches [User Properties](/docs/get-started/user-property-definitions) to all Autocapture events, unless disabled.

### Visual labeling for web

Amplitude's visual labeling tool lets you identify and select individual elements on a page to track. For example, to track the number of users who click a **Sign up** button, select the button with visual labeling. Amplitude then creates an event that targets that specific element.

Events you add with visual labeling work retroactively, because Amplitude captures all form-related events starting when your instrumentation goes live.

For more information, refer to [Visual labeling](/docs/data/visual-labeling).

## Autocapture for iOS

The latest version of Amplitude's [iOS SDK](/docs/sdks/analytics/ios/ios-swift-sdk) includes Autocapture capabilities.

### Install the SDK

Install the SDK as instructed in the [iOS-Swift SDK](/docs/sdks/analytics/ios/ios-swift-sdk#install-the-sdk) documentation.

### Initialize the SDK with Autocapture enabled

By default, the iOS SDK enables session tracking and disables application lifecycle, screen view, and element interaction tracking. To enable all Autocapture capabilities, initialize the SDK with the following snippet:

{% code-group %}
```swift Swift
let amplitude = Amplitude(configuration: Configuration(
    apiKey: "API_KEY",
    autocapture: [.sessions, .appLifecycles, .screenViews, .networkTracking]
))
```

```objc Obj-C
AMPConfiguration* configuration = [AMPConfiguration initWithApiKey:@"API_KEY"];
configuration.autocapture = [[AMPAutocaptureOptions alloc] initWithOptionsToUnion:@[
    AMPAutocaptureOptions.sessions,
    AMPAutocaptureOptions.appLifecycles,
    AMPAutocaptureOptions.screenViews,
    AMPAutocaptureOptions.networkTracking
]];
Amplitude* amplitude = [Amplitude initWithConfiguration:configuration];
```
{% /code-group %}

### Autocapture events

| Event                    | Description                                                                  | Properties                             |
| ------------------------ | ---------------------------------------------------------------------------- | -------------------------------------- |
| Start session            | Captures when a user starts a session in your app.                           | [User properties](#user-properties).   |
| End session              | Captures when a user ends a session in your app.                             | [User properties](#user-properties).   |
| Application installed    | Captures when a user opens the app for the first time after they install it. |                                        |
| Application updated      | Captures when a user opens the app for the first time after they update it.  |                                        |
| Application opened       | Captures when a user launches or foregrounds the app after the first open.   |                                        |
| Application backgrounded | Captures when a user backgrounds the application.                            |                                        |
| Screen viewed            | Captures when a user views a screen in your app.                             | Screen name                            |
| Element Interacted       | Captures when a user interacts with the UI elements in your app.             | Element properties                     |
| Network request          | Captures when a the app makes a network request.                             | URL, request method, status code, etc. |

### User properties

Amplitude attaches [User Properties](/docs/get-started/user-property-definitions) to all Autocapture events, unless disabled.

## Autocapture for Android

The latest version of Amplitude's [Android SDK](/docs/sdks/analytics/android/android-kotlin-sdk) includes Autocapture capabilities.

### Install the SDK

Install the SDK as instructed in the [Android-Kotlin SDK](/docs/sdks/analytics/android/android-kotlin-sdk#install-the-sdk) documentation.

### Initialize the SDK with Autocapture enabled

By default, the Android-Kotlin SDK enables session tracking and disables application lifecycle, screen view, deep link, and element interaction tracking. To enable all Autocapture capabilities, initialize the SDK with the following snippet:

{% code-group %}
```kotlin Kotlin
Amplitude(
	Configuration(
	 apiKey = AMPLITUDE_API_KEY,
		context = applicationContext,
		autocapture = autocaptureOptions {
          +sessions               // or `+Autocapture.SESSIONS` [tl! ~~]
          +appLifecycles          // or `+Autocapture.APP_LIFECYCLES` [tl! ~~]
          +deepLinks              // or `+Autocapture.DEEP_LINKS` [tl! ~~]
          +screenViews            // or `+Autocapture.SCREEN_VIEWS` [tl! ~~]
    	}
	)
)
```

```java Java
Configuration configuration = new Configuration(AMPLITUDE_API_KEY, getApplicationContext());
configuration.getAutocapture().addAll(Arrays.asList(
    AutocaptureOption.APP_LIFECYCLES,
    AutocaptureOption.DEEP_LINKS,
    AutocaptureOption.SCREEN_VIEWS
));

Amplitude amplitude = new Amplitude(configuration);
```
{% /code-group %}

### Autocapture events

| Event                    | Description                                                                  | Properties                           |
| ------------------------ | ---------------------------------------------------------------------------- | ------------------------------------ |
| Start session            | Captures when a user starts a session in your app.                           | [User properties](#user-properties). |
| End session              | Captures when a user ends a session in your app.                             | [User properties](#user-properties). |
| Application installed    | Captures when a user opens the app for the first time after they install it. |                                      |
| Application updated      | Captures when a user opens the app for the first time after they update it.  |                                      |
| Application opened       | Captures when a user launches or foregrounds the app after the first open.   |                                      |
| Application backgrounded | Captures when a user backgrounds the application.                            |                                      |
| Screen viewed            | Captures when a user views a screen in your app.                             | Screen name                          |
| Deep link opened         | Captures when a user opens a deep link in your app.                          | URL and referrer information         |
| Element Interacted       | Captures when a user interacts with the UI elements in your app.             | Element properties                   |

### User properties

Amplitude attaches [User Properties](/docs/get-started/user-property-definitions) to all Autocapture events, unless disabled.
