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.
Evaluates active campaigns for given targeting parameters and returns campaign data, if there is a matching campaign.
email- Emailweb- Webreturns- Returns Portal
24-char hex MongoDB ObjectId of the tracking document
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.
Collects campaign event data (clicks & opens) for analytics purposes and forwards the user to the redirect URL if provided.
24-char hex MongoDB ObjectId of the email document
24-char hex MongoDB ObjectId of the email document
open- openclick- click
email- Emailweb- Webreturns- Returns Portal
24-char hex MongoDB ObjectId of the tracking document
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
openTrackingUrlas the image URL for the campaign’s open-tracking pixel. Outside email, addmedium=webormedium=returns; withoutmedium, the open is recorded asemail.Use
analyticsBaseUrlas the base for click links. Preserve its existing query parameters, then addeventType=click, themedium(email,web, orreturns), and the URL-encodedredirectUrl.For a product-recommendation click, add
rec=1. For an ordinary campaign click, omitrec. Do not userec=false: a nonempty value is treated as a recommendation click.Product-recommendation
article_urlvalues 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?