---
title: Install Amplitude on a website with a script snippet
description: "Add the Amplitude Browser SDK to any website with one script tag in the page head, with Autocapture, Session Replay, and remote config turned on."
product: general
lang: en
last_updated: 2026-10-21
token_estimate: 666
---
# Install Amplitude on a website with a script snippet

> For AI agents: a documentation index is available at [/docs/llms.txt](/docs/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

The Amplitude script snippet installs the Browser SDK on a website with no build step or npm package. Add one script to the `<head>` of your site when you want the fastest possible browser install. Use this option for static sites, CMS-driven sites, or any project where a script tag is easier than an SDK install.

The snippet turns on:

- Script-tag install with no bundler.
- [Autocapture](https://amplitude.com/docs/data/autocapture) and [Session Replay](https://amplitude.com/docs/session-replay).
- Remote config for feature flags.

## Prerequisites

- An Amplitude project and its API key. Create a [free Amplitude account](https://app.amplitude.com/signup) if you need one.
- Access to edit the `<head>` of every page you want to track.

## Install the snippet

1. **Paste the snippet into your site's \`<head>\`**

   Add it to every page you want to track.

   ```html
   <script src="https://cdn.amplitude.com/script/AMPLITUDE_API_KEY.js"></script>
   <script>
     // sampleRate: 1 records 100% of sessions for initial testing; lower this for production. The SDK default (0) records nothing.
     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>
   ```
2. **Set your API key and load the page**

   Replace the placeholder with your project's API key, then load a tracked page in your browser.
3. **Confirm data in Amplitude**

   Open the [Amplitude Debugger](https://amplitude.com/docs/analytics/debug-analytics) and check for page view, session, and interaction events.

## Tips for the script snippet

- Click the **API key** button in the code block to insert your key before you copy the snippet.
- Use the EU CDN host if your project uses EU data residency.
- To track business-critical actions or connect activity to known users, refer to [track an event](https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2#track-an-event) and [custom user identifier](https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2#custom-user-identifier) in the Browser SDK documentation.

