On this page

Use Autocapture to get fast insights

Amplitude Academy

Use Autocapture and Visual Labeling to Track Website Clicks

Simplify your Amplitude implementation and surface your product usage insights fast by learning how to use Autocapture and visual labeling to define your website click events.

Get started

Amplitude's 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

Data region
HTML
<script src="https://cdn.amplitude.com/script/AMPLITUDE_API_KEY.js"></script>
<script>
window.amplitude.add(window.sessionReplay.plugin({sampleRate: 1}));
window.amplitude.init('AMPLITUDE_API_KEY', {"fetchRemoteConfig":true,"autocapture":{"attribution":true,"fileDownloads":true,"formInteractions":true,"pageViews":true,"sessions":true,"elementInteractions":true,"networkTracking":true,"webVitals":true,"frustrationInteractions":true}});
</script>

Initialize the SDK

Browser SDK 2.10.0 and above includes element click and change tracking, which enables visual labeling within Amplitude. To enable it, set config.autocapture.elementInteractions to true when you initialize the SDK.

No extra initialization required.

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

For more information, refer to Autocapture in the Browser SDK 2 documentation.

Default event prefix

Amplitude prefixes Autocapture events with the Amplitude logo.

Marketing attribution

Captures the following properties:

User properties

Amplitude attaches User Properties 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.

Autocapture for iOS

The latest version of Amplitude's iOS SDK includes Autocapture capabilities.

Install the SDK

Install the SDK as instructed in the iOS-Swift 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:

swift
let amplitude = Amplitude(configuration: Configuration(
    apiKey: "API_KEY",
    autocapture: [.sessions, .appLifecycles, .screenViews, .networkTracking]
))

Autocapture events

User properties

Amplitude attaches User Properties to all Autocapture events, unless disabled.

Autocapture for Android

The latest version of Amplitude's Android SDK includes Autocapture capabilities.

Install the SDK

Install the SDK as instructed in the Android-Kotlin 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:

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! ~~]
    	}
	)
)

Autocapture events

User properties

Amplitude attaches User Properties to all Autocapture events, unless disabled.

Was this helpful?