On this page

Quickstart for engineers

For engineers implementing Amplitude15 minIntermediate

This quickstart is for engineers implementing Amplitude for the first time. Follow these steps to install the Browser SDK, verify that events flow into your project, and ship your first feature flag.

You'll set up

Before you start

  • An Amplitude account and a project API key — go to Create a project if you don't have one.

  • Access to your product's codebase (front-end or back-end, depending on your stack).

  • A Member, Developer, or Admin role in your Amplitude organization.

If your team is still deciding what to track, go to Instrumentation prework first to align on a tracking plan before you write any code.

  1. Install

    Add the Browser SDK

    The Browser SDK is the fastest path to getting data into Amplitude. Add it to your site with a script tag or an npm package, then initialize it with your project API key.

    html
    <script type="text/javascript">
      !function(){"use strict";...}();
      amplitude.init('YOUR_API_KEY');
    </script>
    

    Amplitude provides a pre-configured snippet and an AI prompt in your project settings when you first create an account — go to your project settings to copy the snippet for your region.

    Once initialized, call amplitude.track('Event Name', { property: 'value' }) to send your first custom event.

  2. Capture

    Enable Autocapture

    Autocapture tracks clicks, page views, sessions, form interactions, file downloads, and marketing attribution without any manual event calls. Enable it by passing autocapture: true during initialization:

    js
    amplitude.init('YOUR_API_KEY', { autocapture: true });
    

    Check your Amplitude project's Live Events view to confirm events are arriving. You don't need to add any additional tracking code for the behaviors Autocapture handles.

    Autocapture is best for capturing broad behavioral data. For business-critical actions — purchases, upgrades, key feature usage — add explicit amplitude.track() calls so those events carry the right properties.

  3. Experiment

    Launch a feature flag

    Feature Experiment lets you roll out changes to a subset of users without a code deployment. Create a flag in the Amplitude UI, add the SDK to your codebase, and check the flag value at runtime:

    js
    const variant = experiment.variant('my-flag');
    if (variant.value === 'treatment') {
      // show new feature
    }
    

    Go to Feature flag rollouts for a full walkthrough of targeting rules, gradual rollouts, and flag cleanup.

Next steps

Was this helpful?