# Amplitude Destination

> Track user behavior in healthcare with Amplitude analytics built for HIPAA-regulated workflows, enabling secure insights while protecting patient data privacy.

Source: https://docs.oursprivacy.com/docs/destination-amplitude

## Amplitude Features

The Ours Privacy Amplitude integration lets you use Amplitude's analytics (events, user properties, funnels, and retention) while keeping strict control over the PII and PHI that leaves your environment. Ours Privacy forwards the events you already track, along with their properties, into Amplitude as first-class events, so your team gets the insights it needs without raw patient data being sent directly from the browser.

You can redact, hash, or suppress sensitive fields before they reach Amplitude, and choose exactly which events are forwarded through your Allow List.

## What you can do with this integration

* **Track events** to power funnels, retention, and behavioral analysis using Amplitude's [HTTP V2 API](https://amplitude.com/docs/apis/analytics/http-v2).
* **Send user properties** so Amplitude user profiles stay up to date with the attributes you choose to share.
* **Group events into sessions** and attach device and operating system context captured by the Web SDK.
* **Control PII and PHI exposure** by redacting, hashing, or omitting fields before they reach Amplitude.

## Use with the Amplitude SDK

Install the Amplitude SDK alongside this destination for Amplitude Experiments, Session Replay, autocapture, automatic attribution properties, group analytics, and the default dashboards built on them. The two are designed to coexist. Ours Privacy will keep forwarding the events in your Allow List as first-class events, so funnels, retention, and any custom charts built on those events keep working as expected.

## Campaign and referrer data

Ours Privacy captures UTM parameters and referrer information on the events it collects. To make campaign data available in Amplitude, include the campaign values you care about as tracked properties on your events, or map them into **Event Properties** or **User Properties** in the destination's mapping settings. They then appear as ordinary Amplitude properties you can segment and break down by.

## Identity resolution

Amplitude unifies a person across devices and sessions on **User ID**, and treats **Device ID** as the anonymous, per-browser identifier. Both default to the Ours Privacy visitor ID, which is per browser and device. On the default configuration, the same logged-in person using two browsers appears in Amplitude as two users, and pre-login activity does not merge into the identified user.

To get cross-device unification, map **User ID** to your own stable identifier for the person, such as your logged-in customer or patient ID, and leave **Device ID** mapped to the Ours Privacy visitor ID. Amplitude drops identifiers shorter than five characters, so make sure the value you map is long enough.

> **Note:** Changing **User ID** re-buckets how Amplitude counts users going forward. Historical events keep the identifier they were sent with, so expect a break in user counts around the change.

## Adding Amplitude as a destination

To add a destination, click on [Destinations](https://app.oursprivacy.com/destinations) from your Ours Privacy platform. Click the **Add destination** button and select Amplitude as the destination type to add.

Then, copy and paste your **Amplitude API Key** into the Ours Privacy destination configuration tool and press **Save**.

### Find your Amplitude API Key

**If you've previously configured Amplitude:**

1. Log into your Amplitude account
2. Navigate to **Settings**, then **Organization Settings**, then **Projects**
3. Choose the relevant project, and you will find your **API key** under the project's **general** settings

**If you haven't previously set up your Amplitude account**, you will find your API key under "Other ways to install" when getting started on Amplitude.

### Sending User Properties to Amplitude

All events in your Allow List configured to send to this destination will be sent with their event data, including any tracked event properties. Toggling this ON will also send any tracked [user properties](https://docs.oursprivacy.com/docs/visitor-properties-overview). Toggling this OFF will not send any tracked user properties.

### Updating user properties with an Identify event

Ordinary event mappings overwrite a user property every time they send it. Amplitude also supports property *operations*, such as `$setOnce`, which keeps the first value it ever receives and ignores later writes. Operations are only available on Amplitude's `$identify` event, which updates a profile without recording an event.

The **Amplitude Identify** mapping template sends that event. Because Ours Privacy reserves the `$` prefix for system events, you cannot dispatch an event named `$identify` — you send a plain `identify` event and the template supplies the reserved outbound name.

To set it up:

1. Add `identify` to your Allow List and route it to this destination.
2. On the destination's mapping settings, add a mapping and choose the **Amplitude Identify** template.
3. Give that mapping a **higher priority** than any broader mapping that also matches the event. Mappings are selected by priority, so a general-purpose mapping placed above it will win and send the event under its own name instead.
4. Include the properties you want to update as an `amplitude_user_properties` object on the event. The template maps this to **User Properties** for you, so whichever operation you use is passed to Amplitude verbatim.

```json
{
  "event": "identify",
  "event_properties": {
    "amplitude_user_properties": {
      "$setOnce": {
        "Initial UTM Source": "",
        "Initial UTM Medium": "",
        "Initial UTM Campaign": ""
      }
    }
  }
}
```

This is the pattern for first-touch attribution. Send the visitor's campaign values on their first visit, or empty strings when there are none, and Amplitude keeps whichever value arrived first — a later visit that does carry campaign data cannot overwrite it. Your regular event mappings can keep sending the current campaign values as ordinary user properties alongside it.

> **Note:** Amplitude may overwrite first-touch properties when it merges profiles, so validate the result against your identity flow before relying on it.

## When It Dispatches

Our Amplitude integration dispatches events automatically when the required data properties are present. Specifically:

1. **Necessary Properties**: An event will be dispatched if the destination includes a valid Amplitude Project Token and configuration. Additionally, visitor data must be available to ensure that Amplitude can process the event correctly.

2. **Event Type**: Dispatch occurs for all configured event types, allowing you to track a wide range of user interactions within Amplitude.

3. **Automatic Retry**: If the system encounters a retryable error, such as a temporary network issue or API problem, it will automatically attempt to re-dispatch the event. Non-retryable errors, such as missing configuration details, will prevent further retries.

This setup ensures that events are only dispatched to Amplitude when necessary data is present, enabling reliable tracking and insights within your Amplitude dashboard.
