> ## Documentation Index
> Fetch the complete documentation index at: https://zite.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Track product analytics with Amplitude

> Instrument your Zite app with Amplitude to track user behavior, custom events, and query analytics data.

## How it works

Connect your Zite app to Amplitude to track user behavior and measure how people use your published app. Amplitude provides product analytics to help you understand engagement patterns and make data-driven decisions.

Amplitude works in **two directions** in Zite:

**1. Writing events (instrument your app)**
Once Zite adds and initializes Amplitude's browser SDK in your app, your published app can track:

* **Autocapture:** Page views (when users navigate between pages), sessions, form interactions, file downloads, and attribution data
* **Custom events:** Track specific actions like button clicks, purchases, or feature usage by asking Zite to call `trackEvent`
* **User identification:** Identify logged-in users with `identifyUser` to tie events to specific people
* **Reset identity on logout:** Call `resetAnalytics` when users log out so the next user's events aren't attributed to the previous user

<Note>
  **Important:** Tracking only runs on your **live published app**, not in the Zite editor preview. This prevents test clicks from polluting your Amplitude data.
</Note>

**2. Reading data (query analytics)**
Ask Zite questions about your analytics directly in chat, or ask it to display Amplitude data in your app (e.g., signup counts or a metrics dashboard). Both use Amplitude's Dashboard REST API and require your **secret key**. The secret key is optional when connecting—you only need it to read analytics data.

<Note>
  Amplitude requires your own API key from [amplitude.com](https://amplitude.com). Zite does not provide a shared Amplitude account. Your Amplitude plan's limits and pricing apply.
</Note>

## How to integrate Amplitude into your app

<Steps>
  <Step title="Get your Amplitude API key">
    If you don't have an Amplitude account yet, sign up at [amplitude.com](https://amplitude.com). Then, get your **API key** from your [project settings](https://analytics.amplitude.com/settings).

    <Info>
      **Optional:** If you plan to query analytics data from Amplitude in chat or display it in your app, you'll also need your **secret key** from the same settings page. You can add the secret key later if needed.
    </Info>
  </Step>

  <Step title="Connect to Amplitude">
    In the chat box, request your app to be integrated with Amplitude. Then, paste your Amplitude API key when prompted.

    Alternatively, click **+** in the chat box, select **Integrations**, then choose **Amplitude** to connect.
  </Step>

  <Step title="Tell Zite what to track">
    Explain how you want to use Amplitude in your app. For example:

    ```text theme={null}
    Track a "Purchase Completed" event every time a user completes a checkout, and include the order amount as a property.
    ```

    Or for user identification:

    ```text theme={null}
    When a user logs in, identify them in Amplitude with their email and user ID.
    ```
  </Step>

  <Step title="Publish and verify">
    Click `Publish` in the upper right corner to deploy your changes and enable Amplitude tracking on your live app.

    <Tip>
      Trigger an event in your published app, then check your [Amplitude dashboard](https://analytics.amplitude.com/) under **Events** to confirm tracking is working. Events may take time to appear. Remember: events only fire on the published app, not in the editor preview.
    </Tip>
  </Step>
</Steps>

## Common use cases

With an Amplitude connection, you can:

* **Track key product actions:** Log custom events when users complete important actions like submitting forms, clicking CTAs, or using specific features
* **Identify users after login:** Tie events to specific users by identifying them with their email or user ID when they sign in
* **Monitor autocaptured behavior:** See page views, sessions, and form interactions automatically without writing custom tracking code
* **Query analytics data:** Once you've added your secret key, ask Zite for event counts, active user numbers, or other metrics directly in chat or display them in your app
* **Build simple metrics views:** Display charts or stats in your app that pull from Amplitude (e.g., "Signups last week: 142")

Use Amplitude's dashboard to explore funnels, retention, and cohorts. With your secret key connected, Zite can also read analytics data and existing charts from Amplitude to answer questions in chat or display results in your app.

## Important notes

* **Preview vs. live:** Tracking is disabled in the Zite editor preview to prevent polluting your Amplitude data. Events only fire on the published app.
* **No PII or secrets:** Don't send sensitive data like passwords, API keys, or raw credit card numbers as event properties.
* **Event name stability:** Use exact, consistent event names (e.g., `"Form Submitted"`, not `"form submitted"` or `"Form_Submitted"`). Event names are case-sensitive in Amplitude.
* **Secret key for reads:** To query analytics data from Amplitude, you must add your secret key to the connection. The API key alone only supports writing events.
* **Don't send events from endpoints:** Amplitude tracking is browser-side only. Do not attempt to send events from workflows or backend endpoints in Zite.

## Need help?

If you run into issues with Amplitude:

* Check your API key is correct and active
* Verify events are appearing in your Amplitude dashboard (remember: only on the live published app)
* Ensure event names are valid and consistent
* If querying data fails, confirm your secret key is added to the connection
* Review Amplitude's [documentation](https://amplitude.com/docs) for API details

<Info>
  For Zite support, contact us at [support@zite.com](mailto:support@zite.com).
</Info>
