# How integrations work

This page lists every tool Double Agent sends its labels to, what each one receives and which consent it needs. Read
it when you want to filter bots and agents out of your analytics, ad conversions or email lists.

## Nothing to set up for most tools

The script looks for each tool on the page. When it finds one, it sends the verdict to it in that tool's own format.
You don't add code. If GA4 and Meta Pixel are on your site, both start getting `da_class` and the other fields on the
next page load.

Every tool gets the same nine fields: `da_class`, `da_agent`, `da_score`, `da_bucket`, `da_rec`, `da_verified`,
`da_behavior`, `da_behavior_risk` and `da_authorization`. Their values are on
[Verdict](/docs/verdict#properties-and-events).

Tools that take events get `da_classified` once per session, when the first verdict lands. A second event, `da_final`,
is kept for a final verdict from the server. That needs [the Handler](/docs/handler), which is off today, so expect
only `da_classified` for now.

## The built-in tools

| Tool | Found when the page has | What it gets | Consent | Page |
|---|---|---|---|---|
| GA4 | `gtag()` or a `gtag/js?id=G-` script | User properties and the `da_classified` event | analytics | [GA4](/docs/ga4) |
| Google Tag Manager | The GTM container | A `dataLayer` push with the event and nine fields | analytics | [GTM](/docs/gtm) |
| Meta Pixel | `fbq()` | `DoubleAgentClassified` custom event; bot conversions held back | ads | [Ad platforms](/docs/meta) |
| TikTok Pixel | `ttq` | `DoubleAgentClassified` event; bot conversions held back | ads | [Ad platforms](/docs/meta) |
| Google Ads | A `gtag/js?id=AW-` or `googleadservices.com` script, or `gtag('config', 'AW-…')` | Nothing sent; bot conversions held back | ads | [Ad platforms](/docs/meta) |
| Shopify | `window.Shopify` | Cart attributes and `Shopify.analytics` events | functional | [Shopify](/docs/shopify) |
| Stripe | `window.Stripe` | Nothing in the browser; you pass a token on your server | functional | [Stripe](/docs/stripe) |
| Mixpanel | `mixpanel` | Super properties, and people properties after `identify()` | analytics | [Mixpanel](/docs/mixpanel) |
| Segment | `analytics.addSourceMiddleware` | `context.doubleagent` on every event, and `identify` | analytics | [Segment](/docs/segment) |
| PostHog | `posthog` | Event properties, and person properties once the visitor is identified | analytics | [PostHog](/docs/posthog) |
| Amplitude | `amplitude` | User properties | analytics | [Amplitude](/docs/amplitude) |
| Klaviyo | `klaviyo`, `_learnq` or a `static.klaviyo.com` script | Profile properties | ads | [Klaviyo](/docs/klaviyo) |
| Mailchimp | A form posting to `list-manage.com` | A hidden `DACLASS` field | ads | [Mailchimp](/docs/mailchimp) |
| HubSpot | `_hsq` or a HubSpot tracking script | Contact properties | analytics | [HubSpot](/docs/hubspot) |
| Intercom | `Intercom()` | User attributes through `Intercom('update')` | analytics | none |
| Microsoft Clarity | `clarity()` | One custom tag per field | analytics | none |
| Hotjar | `hj()` | Events `da_<class>` (for example `da_bot`) and `da_behavior_<label>` | analytics | none |

Intercom, Clarity and Hotjar need no setup in the tool. Filter recordings or users on the tag or event: in Clarity, the
`da_class` custom tag; in Hotjar, the `da_bot` or `da_agent` event; in Intercom, the `da_class` user attribute.

## Consent

Each tool belongs to a consent category, and the script reads your consent banner before it sends anything:

- **analytics**: sent when the visitor allowed analytics (Google Consent Mode `analytics_storage`, OneTrust group
  `C0002`, Cookiebot statistics, or Shopify's customer privacy API).
- **ads**: sent when the visitor allowed advertising (`ad_storage` and `ad_user_data`, OneTrust `C0004`, Cookiebot
  marketing). Klaviyo and Mailchimp are in this group because they feed marketing lists.
- **functional**: sent with analytics consent, or always when the script runs with `mode: 'security'`.

With no banner on the page, every category counts as allowed. Holding back ad conversions from bots is not tracking,
so it runs whatever the consent. More on consent: [Privacy and consent](/docs/safehouse).

## Choose which tools run

By default every tool the script finds gets the fields. To pick them yourself, pass `integrations` in a queued init.
Only the tools you list run:

```js
doubleagent.push('init', { integrations: { ga4: { trafficType: true }, meta: true, hubspot: true } });
```

`true` turns a tool on. An object turns it on with options: `ga4` takes `trafficType`, `hubspot` takes `eventName`. The
names are `ga4`, `gtm`, `meta`, `tiktok`, `gads`, `shopify`, `stripe`, `mixpanel`, `segment`, `posthog`, `amplitude`,
`klaviyo`, `mailchimp`, `hubspot`, `intercom`, `clarity` and `hotjar`. For a tool not on this list, write a plugin:
[Plugins](/docs/plugins).

## Keep bots out of ad numbers

Meta, TikTok and Google Ads conversions are held back for confident bots. The rules and the setting are on
[Meta, TikTok and Google Ads](/docs/meta).

## When a verdict changes later

The browser sends what it knows on the page. When the server later settles a different label, it can correct GA4,
Mixpanel, Klaviyo, Shopify orders and Stripe payments itself, with credentials you give it. See
[Relabel](/docs/relabel).

**Next:** set up the tool you use most, for example [GA4](/docs/ga4) or [Meta, TikTok and Google Ads](/docs/meta).
