Skip to content
You're viewing the API v4 documentation, recommended for new integrations.
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Campaigns

Our API allows you to retrieve targeted campaign data and collect analytics data for your campaigns.

Overview

These requests allow you to get campaign data based on targeting parameters and gain insights into your campaign performance with a single HTTPS request.

You can retrieve active campaigns through these APIs using set parameters (for example: language and campaign medium) in order to find matching campaigns for evaluation. Additionally, you can track campaign event data for analytics purposes and monitor how your campaigns are performing.

Get Campaign Data

You can retrieve campaign data of active campaigns based on the parameters provided using the v4/campaign/evaluate endpoint.

Evaluate Campaign Targeting

get

Evaluates active campaigns for given targeting parameters and returns campaign data, if there is a matching campaign.

Query parameters
accountIdintegerOptional
campaignIdstring · min: 1 · max: 24Optional
languagestring · min: 1 · max: 5Optional
mediumstring · enum · min: 1Optional
  • email - Email
  • web - Web
  • returns - Returns Portal
Possible values:
messagestring · min: 1 · max: 255Optional
orderNumberstring · min: 1Optional
previewbooleanOptional
statusstring · min: 1 · max: 255Optional
trackingIdstringOptional

24-char hex MongoDB ObjectId of the tracking document

Responses
200Success
application/json
campaignIdstring · max: 24 · nullableRequired
trackingIdstring · max: 24 · nullableRequired
customerSegmentationIdstring · max: 24 · nullableOptional
audienceIdstring · max: 24 · nullableOptional
openTrackingUrlstring · max: 1024Optional
analyticsBaseUrlstring · max: 1024Optional
accountHasActiveCampaignsboolean · nullableRequired
get/v4/campaign/evaluate/
GET /v4/campaign/evaluate/ HTTP/1.1
Host: api.parcellab.com
Accept: */*
{
  "campaignId": null,
  "trackingId": null,
  "customerSegmentationId": null,
  "audienceId": null,
  "openTrackingUrl": "text",
  "analyticsBaseUrl": "text",
  "values": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "placeholders": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "typedValues": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "accountHasActiveCampaigns": null
}

Collect Campaign Events

Use GET /v4/campaign/redirect/ to record an event and optionally redirect the visitor. This endpoint collects analytics events; it does not return an analytics report.

Campaign Analytics Service

get

Collects campaign event data (clicks & opens) for analytics purposes and forwards the user to the redirect URL if provided.

Query parameters
cstring · min: 1 · max: 24Optional
campaignIdstring · min: 1 · max: 24Optional
contentTypestring · min: 1 · max: 1024Optional
customerSegmentationIdstring · min: 1 · max: 24Optional
estringOptional

24-char hex MongoDB ObjectId of the email document

emailIdstringOptional

24-char hex MongoDB ObjectId of the email document

eventTypestring · enum · min: 1Required
  • open - open
  • click - click
Possible values:
mediumstring · enum · min: 1Optional
  • email - Email
  • web - Web
  • returns - Returns Portal
Possible values:
redirectUrlstring · min: 1 · max: 1024Optional
sstring · min: 1 · max: 24Optional
trackingIdstringOptional

24-char hex MongoDB ObjectId of the tracking document

Responses
200Success
application/json
campaignIdstring · max: 24 · nullableRequired
trackingIdstring · max: 24 · nullableRequired
customerSegmentationIdstring · max: 24 · nullableOptional
audienceIdstring · max: 24 · nullableOptional
openTrackingUrlstring · max: 1024Optional
analyticsBaseUrlstring · max: 1024Optional
accountHasActiveCampaignsboolean · nullableRequired
get/v4/campaign/redirect/
GET /v4/campaign/redirect/?eventType=open HTTP/1.1
Host: api.parcellab.com
Accept: */*
{
  "campaignId": null,
  "trackingId": null,
  "customerSegmentationId": null,
  "audienceId": null,
  "openTrackingUrl": "text",
  "analyticsBaseUrl": "text",
  "values": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "placeholders": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "typedValues": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "accountHasActiveCampaigns": null
}

Use the Returned Tracking URLs

The evaluation response includes openTrackingUrl and analyticsBaseUrl when a campaign is available. Use these URLs as returned. They contain campaign and tracking context and can use a different host and route version from the evaluation request.

  • Use openTrackingUrl as the image URL for the campaign’s open-tracking pixel. Outside email, add medium=web or medium=returns; without medium, the open is recorded as email.

  • Use analyticsBaseUrl as the base for click links. Preserve its existing query parameters, then add eventType=click, the medium (email, web, or returns), and the URL-encoded redirectUrl.

  • For a product-recommendation click, add rec=1. For an ordinary campaign click, omit rec. Do not use rec=false: a nonempty value is treated as a recommendation click.

  • Product-recommendation article_url values in the evaluation response are already click-tracking links. Use them as returned.

The following example assumes campaign contains the evaluation response:

Use a destination approved for your campaign. A permitted redirectUrl produces an HTTP 302 redirect. Without it, the endpoint returns HTTP 200 with an empty body. An event is recorded only when both eventType and medium are present. An invalid or blocked destination can return 400. A successful redirect confirms navigation; it does not by itself confirm that an analytics event was stored.

GET /v4/campaign/evaluate/ and GET /v4/campaign/redirect/ are public endpoints and do not require an API token. The returned tracking URLs also work without a token. The generated OpenAPI reference currently shows an incorrect token requirement for these endpoints; see Access by Endpoint.

Last updated

Was this helpful?