Forward Events from a CDP or Server
Overview
Audience: Customer engineers and integration partners feeding the Collector from a customer data platform (CDP), analytics stack, or homegrown event source.
Arc XP Compass learns from user–item interactions: it needs to know what content exists (the catalog) and what your audience does with it (the events). Producing both is a job on your side. This guide covers the events: translate your source’s events (page views, clicks, scroll depth) into the canonical event envelope and POST them to the Collector. See Forwarding events from a CDP or server-side source.
To bulk-load your back catalog and keep it current, see Sync Your Content Catalog with Compass. The two jobs are complementary. A typical onboarding is: bulk-load the back catalog once, wire ongoing content sync, and forward events from your CDP or analytics source in parallel. The Compass Onboarding Checklist gives the full sequence.
Before you start: auth, endpoints, and retries
Content sync and event forwarding hit the same Collector, authenticate the same way, and share the same error-handling contract. This section states those shared rules once.
Endpoints
| Endpoint | Use |
|---|---|
POST /collector/v1/content | A single UpsertContent object — one catalog item per request. |
POST /collector/v1/events | A single event-envelope object. |
POST /collector/v1/events/batch | A JSON array of up to 100 event envelopes. |
The content endpoint has no batch variant — “bulk load” means streaming items through the single-item endpoint (see Run the bulk load). Only the events endpoint batches, at up to 100 per request.
Your tenant is resolved automatically from your unique base URL (https://{org}-config-prod.api.arc-cdn.net) — your Arc XP contact provides the exact host during onboarding.
Authentication
Authenticate every request with your Collector (Collector API Headless) API token in the X-API-Key header — not the Recommendations API token. It is a server-side secret: load it from a secret store, never hard-code it. The token must be provisioned against the Collector API key collection; a token from the wrong key collection fails auth. See Provision and Manage Compass API Keys for provisioning and handling rules, and Authentication and tokens for key-collection separation.
Error and retry behavior
Every Collector POST — content or event, single or batch — returns the same status contract:
| Status | Meaning | Caller action |
|---|---|---|
202 (or 2xx) | The item/event was durably accepted for processing. | None. A 202 confirms the payload was queued, not that it is fully visible to the model yet. |
401 / 403 | X-API-Key is missing, unknown, or the wrong host. | Stop. Verify the token, that it was provisioned against the Collector API key collection, and the base URL. |
422 | The payload failed validation (bad enum, naive datetime, missing required field, unknown event_type, oversize field). | Do not retry as-is — the response body identifies the offending field via detail[*].loc. Fix the row/mapping and resubmit. |
5xx / 429 | Transient server-side or rate error. | Retry the same request with exponential backoff. Cap attempts so a stuck job doesn’t stall the rest of the load. |
A 422 on one item does not stop the rest — each request is independent. Surface the failed row to your operator with the response body.
A stable item_id underpins everything
Content sync and event forwarding both key on item_id, and it must be stable: the same content item must always produce the same item_id, and the value the bulk load sends must match what the live content sync and every forwarded event will send for that same item. There is no retroactive rebind. Settle your scheme — stability, format, length, no-PII — against the Item ID Guidance before you send the first request. The same discipline applies to user_id on events; see the User ID Guidance.
Forwarding events from a CDP or server-side source
This section explains how to translate your CDP, analytics, or homegrown event source into the Compass event envelope and POST it to the Collector. Auth, the events endpoints, and retry behavior are the shared rules in Before you start.
What Compass needs from your CDP
Compass trains its recommendation models on user–item interactions. Whatever your source emits, the translation you write needs to answer four questions for every event:
| Needs | Meaning | Examples |
|---|---|---|
| Who | A stable identifier for the user (user_id) | logged-in ID, cookie ID, CDP profile ID |
| What | The content item interacted with (item_id) | your CMS’s internal record ID (e.g. WordPress post_id, Arc XP _id) |
| How | The kind of interaction (event_type) | page view, click, save |
| When | A timezone-aware timestamp (timestamp) | 2026-03-27T14:30:00+00:00 |
Event taxonomy
Compass accepts a fixed set of event_type values — the Supported Event Types table in the API Developer Guide is the authoritative list. On the CDP side your job is to map your source’s native event names onto those values and drop events that don’t map (ad-stack telemetry, consent pings, etc.) rather than forcing them in.
Identity model
Map your source’s stable visitor identifier onto user_id — a CDP-assigned profile ID or a persistent cookie ID works, a per-page-load random value does not. If a visitor logs in mid-session and your source switches from a cookie ID to an account ID, those look like two different users, so decide an identity-resolution strategy on your side. The full anonymization and stability rules are in the User ID Guidance.
item_id conventions
Use your CMS’s internal record ID (e.g. WordPress post_id, Arc XP _id) as item_id, applied consistently, and match the value the content catalog uses for the same item — see A stable item_id underpins everything and the Item ID Guidance.
Batching guidance
Batch for throughput, but don’t sit on events: behavioral recency matters for recommendations. A few seconds to a few minutes of buffering is reasonable for a forwarder; multi-hour batch windows materially degrade recommendation freshness (see the analytics-only section for the worst case). Each batch request is capped at 100 events — see the Batch API for the request format and limits.
Timestamp conventions
The forwarder-specific rule worth repeating: send the time the interaction actually occurred, not the time your forwarder processed it — stale timestamps skew the recency signal that drives recommendations. Prefer UTC; a wrong offset shifts the event in time just as badly. (The base format rule — timezone-aware ISO 8601, naive timestamps rejected — is in the envelope field reference.)
The event envelope
Every event you send is one event-envelope JSON object. The full field reference — types, required vs. optional, and the 422 validation rules — lives in the API Developer Guide (single events) and the Batch API (batched events). This section covers only what you need to produce the shape from a CDP or analytics source.
A minimal valid envelope is the four required fields — user_id, item_id, event_type, and a timezone-aware timestamp:
{ "user_id": "abc-123", "item_id": "ZSGXFR2KNFCMPN3VHPWQR3BGCE", "event_type": "page_view", "timestamp": "2026-03-27T14:30:00+00:00"}event_value (a 0.0–1.0 ratio such as scroll depth — not a raw count or duration) and session_id are the optional fields you’re most likely to add:
{ "user_id": "abc-123", "item_id": "ZSGXFR2KNFCMPN3VHPWQR3BGCE", "event_type": "deepest_scroll", "timestamp": "2026-03-27T14:32:00+00:00", "event_value": 0.75, "session_id": "sess-a1b2c3"}Don’t invent fields outside the documented schema, and leave schema_version unset — any value other than 1 is rejected by design, so old shapes can’t silently degrade analytics.
event_id and de-duplication
If you omit event_id, the Collector fills it deterministically from a hash of the event’s natural identity (user_id, item_id, event_type, timestamp, session_id, and any attribution ID). Under at-least-once delivery — a forwarder retry, a redelivered S3 object — two copies of the same logical event hash to the same event_id, so downstream de-dup treats them as one. The hash only collapses retries whose fields are identical: if you mutate any of those fields between retries (most commonly by stamping a fresh “now” instead of the original interaction time), Compass sees a different event. We recommend omitting event_id and letting Compass derive it, unless your source emits its own stable per-event ID you specifically want preserved end to end (then set event_id to that value).
Where to send it
Send events to POST /collector/v1/events (one envelope) or POST /collector/v1/events/batch (a JSON array of up to 100 envelopes), authenticated with your Collector key in X-API-Key — see Endpoints and Authentication.
Connecting BlueConic
BlueConic emits events via a customer-templated HTTP webhook destination (Mustache). You configure the webhook to render each outbound event directly as an event envelope, so no separate forwarder is needed.
1. Use the Compass BlueConic Mustache template
Download the BlueConic template bundle — a ready-to-paste blueconic.mustache with field-mapping notes in its README.md.
2. Configure the BlueConic webhook destination
In BlueConic (Connections → add a Webhook/HTTP connection):
- Destination URL:
https://{org}-config-prod.api.arc-cdn.net/collector/v1/events. - Method:
POST, Content-Type:application/json. - Headers: add
X-API-Key: <your-api-key>. - Payload: paste the Mustache template; map your BlueConic profile/event properties onto the envelope fields (the user identifier →
user_id, the content URL/ID →item_id, the BlueConic event type → anevent_type). - Timestamp: ensure the rendered timestamp is timezone-aware ISO 8601.
- Set the connection’s trigger/goal so it fires on the behavioral events you want Compass to learn from.
BlueConic posts one event per webhook fire to the single-event endpoint; you don’t manage batching yourself. Then verify events are arriving.
Connecting Amplitude / Adobe RT-CDP / Tealium / other HTTP CDP
If your CDP can call an outbound HTTP destination but can’t render the event-envelope shape itself (unlike BlueConic’s Mustache), run a small forwarder: it receives or polls your CDP’s events, translates each to the event envelope, and POSTs batches to Compass. The snippet below is a complete, self-contained forwarder core — fill in translate() with your vendor’s field mapping.
This mirrors the batching/retry conventions of the reference S3 forwarder template so the two stay consistent.
"""Minimal Content Recommendations HTTP forwarder. Translate your CDP records, then POST in batches of <=100."""
import jsonimport timeimport urllib.errorimport urllib.request
COLLECTOR_URL = "https://{org}-config-prod.api.arc-cdn.net"BATCH_PATH = "/collector/v1/events/batch"HEADERS = { "X-API-Key": "<your-api-key>", # load from a secret store; never hard-code "Content-Type": "application/json",}MAX_BATCH = 100MAX_ATTEMPTS = 3
def translate(record: dict) -> dict | None: """Map ONE of your CDP's records to the event envelope. Return None to drop it.
Replace the right-hand sides with your vendor's field paths. Drop events that don't map to the Content Recommendations taxonomy (ad telemetry, consent pings, etc.). """ event_type = {"pageview": "page_view", "click": "click"}.get(record.get("type")) if event_type is None: return None return { "user_id": record["user_id"], # stable per-visitor identifier "item_id": record["content_id"], # your CMS's internal record ID (stable primary key) "event_type": event_type, "timestamp": record["time"], # tz-aware ISO 8601, e.g. 2026-03-27T14:30:00Z # Optional: "session_id", "event_value" (0.0-1.0). Omit "event_id" to let the collector derive it. }
def _post_batch(batch: list[dict]) -> None: body = json.dumps(batch).encode("utf-8") req = urllib.request.Request(COLLECTOR_URL + BATCH_PATH, data=body, headers=HEADERS, method="POST") for attempt in range(MAX_ATTEMPTS): try: with urllib.request.urlopen(req, timeout=10) as resp: # noqa: S310 resp.read() return except urllib.error.HTTPError as exc: if not (exc.code == 429 or 500 <= exc.code < 600): raise # 4xx (e.g. 422 bad envelope) is permanent — fix the mapping except OSError: pass # transient network/timeout error — retry time.sleep(2**attempt) # backoff: 1s, 2s, 4s raise RuntimeError("batch failed after retries")
def forward(records: list[dict]) -> None: envelopes = [e for r in records if (e := translate(r)) is not None] for i in range(0, len(envelopes), MAX_BATCH): _post_batch(envelopes[i : i + MAX_BATCH])Key points: batch to at most 100, retry only on 5xx / 429 / network errors (a 422 means a bad envelope — fix translate(), don’t retry), and set the X-API-Key auth header on every request (load it from a secret store). This is the shared error and retry behavior applied in code.
Per-vendor notes
- Amplitude — Use the Event Streaming / forwarding destination to your forwarder, or pull via the Export API. Amplitude’s
user_id/device_idsplit maps touser_id: preferuser_idwhen present, fall back todevice_id. Mapevent_typenames onto the Compass taxonomy intranslate(). - Adobe Real-Time CDP — Use a streaming destination or the Edge Network to reach your forwarder. Resolve an XDM identity into a stable
user_id; map XDMweb.webPageDetails/media.*events onto the taxonomy. - Tealium — Use an EventStream connector (or a webhook destination from Tealium iQ) to your forwarder. The data-layer variable you use for identity becomes
user_id; the page/content URL becomesitem_id. - Any other HTTP CDP — Same shape: get the events to your forwarder, write
translate(), POST batches.
Connecting an S3-transport CDP (Permutive, ActionIQ S3)
Some CDPs don’t offer an HTTP webhook destination — they stream activations to an S3 bucket as gzipped NDJSON (Permutive today; ActionIQ S3 activations potentially). Compass does not ingest from object storage. Instead, run a small forwarder Lambda in your own AWS account that reads your bucket and POSTs batches to Compass.
Compass ships a runnable, forkable reference template for exactly this — the S3 forwarder Lambda (s3-forwarder). Download the S3 forwarder template bundle to fork into your own account.
It carries all the S3-side plumbing — s3:ObjectCreated trigger, gunzip + NDJSON parse, batching to 100, Secrets-Manager-backed auth, exponential-backoff retry, and an SQS dead-letter queue. You fork it into your account and write a translate() adapter for your CDP’s record shape (the template includes Permutive-specific field mappings as a worked example). Its bundled README covers deploy steps.
Connecting an analytics-only stack (GA4, Sophi, other)
Some sites collect behavioral events in an analytics tool, not a CDP — most commonly Google Analytics 4 (GA4) or Sophi. These tools don’t sit between your site and a destination the way a CDP does, so there’s no webhook to point at Compass. The integration path is a warehouse export: read the events your analytics tool lands in its data warehouse and forward them to Compass from your own cloud.
GA4 from BigQuery (warehouse export)
Read GA4’s BigQuery export and forward to Compass from your own GCP project. The pattern — a scheduled query / Cloud Function over the daily events_YYYYMMDD table — inlines below (it’s small enough not to warrant a separate template directory).
"""GA4 BigQuery -> Content Recommendations forwarder. Run as a scheduled Cloud Function in YOUR GCP project.
Reads the prior day's events_YYYYMMDD export table, maps GA4 rows to the event envelope,and POSTs to /events/batch (<=100 per request). The daily table is next-day batch; forfresher data enable streaming export and read events_intraday_YYYYMMDD instead."""
import datetimeimport jsonimport timeimport urllib.errorimport urllib.request
from google.cloud import bigquery # type: ignore[import-untyped]
COLLECTOR_URL = "https://{org}-config-prod.api.arc-cdn.net"HEADERS = { "X-API-Key": "<your-api-key>", # load from Secret Manager; never hard-code "Content-Type": "application/json",}GA4_DATASET = "analytics_000000000" # your GA4 BigQuery export datasetMAX_BATCH = 100
# Map GA4 event_name -> Content Recommendations event_type. Drop everything not listed.# Map your org-defined GA4 events (saves, scroll depth, engaged reads) onto# article_save / deepest_scroll / engaged_read as appropriate._EVENT_TYPES = { "page_view": "page_view", "select_content": "click", "search": "search", "share": "share",}
def _string_param(row: dict, key: str) -> str | None: """Pull a string event-param value out of GA4's repeated event_params array.""" for p in row.get("event_params", []): if p["key"] == key: return p["value"].get("string_value") return None
def _to_envelope(row: dict) -> dict | None: event_type = _EVENT_TYPES.get(row["event_name"]) item_id = _string_param(row, "content_id") # stable CMS record-ID param; do not fall back to the URL if event_type is None or not item_id or not row.get("user_pseudo_id"): return None # GA4 event_timestamp is epoch microseconds, UTC. ts = datetime.datetime.fromtimestamp(row["event_timestamp"] / 1_000_000, tz=datetime.UTC) return { "user_id": row.get("user_id") or row["user_pseudo_id"], # logged-in id, else pseudo id "item_id": item_id, "event_type": event_type, "timestamp": ts.isoformat(), # tz-aware ISO 8601 }
def _post_batch(batch: list[dict]) -> None: body = json.dumps(batch).encode("utf-8") req = urllib.request.Request( COLLECTOR_URL + "/collector/v1/events/batch", data=body, headers=HEADERS, method="POST" ) for attempt in range(3): try: with urllib.request.urlopen(req, timeout=10) as resp: # noqa: S310 resp.read() return except urllib.error.HTTPError as exc: if not (exc.code == 429 or 500 <= exc.code < 600): raise # permanent (e.g. 422 bad envelope) except OSError: pass # transient network/timeout error — retry time.sleep(2**attempt) raise RuntimeError("batch failed after retries")
def run(yyyymmdd: str) -> None: client = bigquery.Client() table = f"{GA4_DATASET}.events_{yyyymmdd}" rows = client.query(f"SELECT * FROM `{table}`").result() # noqa: S608 - dataset is your own config batch: list[dict] = [] for row in rows: envelope = _to_envelope(dict(row)) if envelope is None: continue batch.append(envelope) if len(batch) == MAX_BATCH: _post_batch(batch) batch = [] if batch: _post_batch(batch)Deploy as a Cloud Function triggered by Cloud Scheduler (e.g. daily after the export lands). You operate this in your own GCP project — Compass doesn’t run it for you.
Sophi integration note
Sophi collects through its own SDK / hosted pipeline. Unverified (no live vendor access at time of writing): whether Sophi exposes an outbound real-time webhook or a documented streaming/partner export API is not confirmed. If your Sophi contract includes a webhook or export, you can forward from it using the same HTTP forwarder snippet (or the S3 forwarder if the export is to S3). Confirm Sophi’s actual export capabilities with your Sophi account team before building a server-side forwarder.
Connecting a homegrown event source
If you emit events from your own application code or a homegrown pipeline, you’re already in control of the shape — just produce the event envelope and POST it. Use the inline HTTP forwarder snippet as your starting point: it shows the batching, retry, and header conventions Compass expects. The only part specific to you is translate() — and if your code can emit the envelope directly, you can skip translation and POST envelopes straight to /events/batch.
Verifying events are arriving
After wiring up any of the paths on this page:
-
Send a known test event. POST a single, hand-built envelope to
/collector/v1/eventswith a recognizableuser_id(e.g.qa-smoke-001) and a current timestamp.Terminal window curl -i -X POST \"https://{org}-config-prod.api.arc-cdn.net/collector/v1/events" \-H "X-API-Key: <your-api-key>" \-H "Content-Type: application/json" \-d '{"user_id":"qa-smoke-001","item_id":"test-item-1","event_type":"page_view","timestamp":"2026-03-27T14:30:00+00:00"}' -
Confirm the response. A
2xx(typically202/200) means the envelope was accepted. A422is a validation failure — the response body names the offending field; fix it (most often a naive timestamp or an unknownevent_type). -
Confirm auth. A
401/403means a wrongX-API-Keyor the wrong host. Re-check your key and base URL. -
Confirm volume. After your integration is live, your forwarder/webhook logs (or the S3 forwarder’s CloudWatch
processed_objectlines, or the GA4 function logs) should show steady accepted batches with few or no422s. -
What success looks like: a steady stream of
2xxresponses, validation-failure rate near zero, and recommendation quality improving as interaction history accumulates. (New tenants go through a cold-start period before history is rich enough — ask your Arc XP contact about expected ramp.)
If a step fails, or events are accepted but recommendations don’t improve, see Events aren't arriving or aren't helping for a debugging table and common pitfalls.
See also
- Item ID Guidance — choosing a stable
item_id. - User ID Guidance — anonymization and stability rules for
user_id. - Provision and Manage Compass API Keys — provisioning and handling the collector key.
- Sync Your Content Catalog with Compass — bulk-loading and syncing the content catalog.
- Troubleshoot Compass Recommendations — diagnosing refused requests, empty results, and events that aren’t helping.
- Compass Onboarding Checklist — phase-by-phase rollout steps.
- Compass Batch API (events) — events batch request format and limits.
- Compass API Developer Guide — endpoint-level reference and field details.
- Provisioning tokens through Delivery API — token provisioning.