Campaign Analytics
This endpoint retrieves performance metrics for a specific campaign providing detailed analytics to help assess campaign effectiveness and recipient engagement, including:
- Delivery counts
- Open rates
- Click rates
- Bounce counts
- Unsubscribe rates
Endpoint
POST /analytics/campaign
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer <your-api-key> | ✅ Yes |
Content-Type | application/json | ✅ Yes |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
campaignId | String | ✅ Yes | The unique identifier for the campaign |
Examples
Request
- JavaScript
- Python
- C#
- PHP
- cURL
const response = await fetch("https://api.basicsengage.com/api/v0/dev/analytics/campaign", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer <your-api-key>"
},
body: JSON.stringify({
campaignId: "64a55f123abcde1234567890"
})
});
const data = await response.json();
console.log(data);
import requests
url = "https://api.basicsengage.com/api/v0/dev/analytics/campaign"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer <your-api-key>"
}
data = {"campaignId": "64a55f123abcde1234567890"}
response = requests.post(url, headers=headers, json=data)
print(response.json())
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
private static readonly HttpClient client = new HttpClient();
static async Task Main()
{
var url = "https://api.basicsengage.com/api/v0/dev/analytics/campaign";
var apiKey = "Bearer <your-api-key>";
client.DefaultRequestHeaders.Clear();
client.DefaultRequestHeaders.Add("Authorization", apiKey);
var data = new
{
campaignId = "64a55f123abcde1234567890"
};
var json = System.Text.Json.JsonSerializer.Serialize(data);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(url, content);
var responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseString);
}
}
<?php
$url = "https://api.basicsengage.com/api/v0/dev/analytics/campaign";
$headers = [
"Content-Type: application/json",
"Authorization: Bearer <your-api-key>"
];
$data = [
"campaignId" => "64a55f123abcde1234567890"
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
curl -X POST "https://api.basicsengage.com/api/v0/dev/analytics/campaign" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your-api-key>" \
-d '{
"campaignId": "64a55f123abcde1234567890"
}'
Responses
- 🟢 200
- 🔴 400
- 🔴 401
- 🔴 404
- 🔴 500
{
"status": "success",
"data": {
"campaignOverview": {
"totalProfileCount": 1000,
"totalDeliveryEvents": 900,
"totalBounceEvents": 50,
"unsubscribesPercentage": 3,
"uniqueOpenRate": 60,
"uniqueClickRate": 25
},
"sortedLinks": [
{
"link": "https://example.com",
"clickCount": 100
},
{
"link": "https://another.com",
"clickCount": 30
}
],
"chartDate": {
"openRateChartData": [],
"clickRateChartData": [],
"suspendedProfilesChartData": [],
"conversionChartData": [1000, 900, 600, 250]
}
}
}
{
"status": "error",
"error": "Missing required field: 'campaignId'."
}
{
"status": "error",
"message": "Invalid API Key"
}
{
"status": "error",
"error": "Campaign not found with the given ID."
}
{
"status": "error",
"message": "Internal server error. Please try again later."
}