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

# StackAdapt

> Connect StackAdapt to SegmentStream and import campaign cost data.

## Getting started

<Steps>
  <Step title="Generate an API token in StackAdapt">
    In StackAdapt, generate a personal API token from your account settings. The token needs read access to the advertisers whose spend you want to import.
  </Step>

  <Step title="Navigate to Data Sources">
    Inside the SegmentStream admin panel, navigate to the **Data Sources** page and click **+ NEW** in the top-right corner.
  </Step>

  <Step title="Select StackAdapt">
    Choose **StackAdapt** from the list.
  </Step>

  <Step title="Enter your API token">
    Paste the token into the **StackAdapt API token** field and continue.
  </Step>

  <Step title="Add advertiser IDs">
    In the **Advertiser IDs** field, add the numeric ID for each advertiser you want to import. Use **Add advertiser ID** to add more than one — a single data source can pull spend for multiple advertisers under the same token.
  </Step>

  <Step title="Save">
    Click **Save**.
  </Step>
</Steps>

## UTM tagging best practices

SegmentStream reads UTM parameters directly from each ad's **click URL** in StackAdapt. Only the standard `utm_*` keys are picked up — `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term`, and `utm_id`. Any other query parameters on the URL are ignored by the connector.

Populate the values with StackAdapt's dynamic macros so each ad reports its own campaign, line item, and creative on click:

```plain text theme={null}
utm_source=stackadapt&utm_medium=paid&utm_campaign={SA_CAMPAIGN_NAME}&utm_content={SA_CREATIVE_ID}&utm_id={SA_CAMPAIGN_ID}
```

Add this to the **landing page URL configuration** on each campaign in StackAdapt Campaign Manager. Keep the curly braces on the macros — StackAdapt substitutes the real values at click time.

Available StackAdapt macros:

| Macro                | Substituted with  |
| -------------------- | ----------------- |
| `{SA_CAMPAIGN_NAME}` | The campaign name |
| `{SA_CAMPAIGN_ID}`   | The campaign ID   |
| `{SA_LINE_ITEM_ID}`  | The line item ID  |
| `{SA_CREATIVE_ID}`   | The creative ID   |

Once the click URLs carry `utm_source`, `utm_medium`, and `utm_campaign`, StackAdapt cost data will join to sessions in SegmentStream reports.

<Tip>
  If spend loads into your reports but campaigns don't appear alongside sessions, open a served click URL and confirm that `utm_source`, `utm_medium`, and `utm_campaign` are present and non-empty. StackAdapt's own `{SA_*}` macros only substitute after the ad is served — a preview URL in the campaign manager may still show the literal `{SA_CAMPAIGN_NAME}` text.
</Tip>
