# Connect

Connect a Campaign Manager 360 user profile with Google OAuth, through Zernio's picker or your own.

**Coming soon.** Google is still verifying the `dfatrafficking` permission on Zernio's app, so connecting may not work for your Google account yet.

## Before you start

Use a Google user with a Campaign Manager 360 user profile. It needs access to the Floodlight configuration of the activities you send to.

## Start the connection

Get a Google sign-in URL for a profile and send the user to `authUrl`:

```bash
curl "https://zernio.com/api/v1/connect/campaignmanager360?profileId=PROFILE_ID&redirect_url=https://app.example.com/connected" \
  -H "Authorization: Bearer $ZERNIO_API_KEY"
```

```json
{ "authUrl": "https://accounts.google.com/o/oauth2/v2/auth?...", "state": "..." }
```

Zernio asks for two permissions: `datamanager` to send conversions, and `dfatrafficking` to list advertisers and Floodlight activities. Campaign Manager has no read-only permission for those lists.

With one Campaign Manager 360 user profile, Zernio connects it and redirects to `redirect_url` with `connected=campaignmanager360`, `profileId`, `accountId` and `username`. With several, the user first picks one on a Zernio page.

In the dashboard, open **Connections** and pick **Campaign Manager 360**.

## Use your own picker

Add `headless=true` to `redirect_url`. Zernio then redirects there with `step=select_profile` and a `pendingDataToken`. List the user profiles, then connect the one picked:

```bash
curl "https://zernio.com/api/v1/connect/campaignmanager360/profiles?pendingDataToken=TOKEN" \
  -H "Authorization: Bearer $ZERNIO_API_KEY"

curl -X POST "https://zernio.com/api/v1/connect/campaignmanager360/select-profile" \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "pendingDataToken": "TOKEN", "cmProfileId": "1234567" }'
```

| Field | What it is |
|-------|------------|
| `pendingDataToken` | The token from the headless redirect. It expires after one hour. Listing does not use it up; connecting does |
| `cmProfileId` | A Campaign Manager 360 user profile id from the list |

## How it behaves

- Each connection is one Campaign Manager 360 user profile. Its destinations are the Floodlight activities of every advertiser it reaches.
- List them with [`GET /v1/ads/conversions/destinations`](/conversions/list-ad-conversion-destinations). A Floodlight configuration the user cannot read lists no activities.
- To reconnect, pass `reconnectAccountId`. Picking a different user profile then fails instead of adding a second account.

## If it fails

The redirect carries `error`, `platform=campaignmanager360` and `error_message`:

| Error | Cause | Fix |
|-------|-------|-----|
| `campaignmanager360_scope_missing` | The user unticked one of the two permissions | Connect again and keep both ticked. |
| `campaignmanager360_no_profiles` | The Google account has no Campaign Manager 360 user profile | Sign in with a user that has one. |
| `campaignmanager360_no_refresh_token` | Google returned no refresh token | Connect again. |
| `503` on the connect URL | Campaign Manager 360 OAuth is not configured on the server | Contact support. |

## Related

- [Get the Campaign Manager 360 connect URL](/connect/get-campaign-manager-connect-url)
- [List Campaign Manager 360 profiles](/connect/list-campaign-manager-profiles)
- [Connect the chosen profile](/connect/select-campaign-manager-profile)
- [Conversions](/platforms/campaign-manager-360/conversions)