> For the complete documentation index, see [llms.txt](https://fair-indonesia.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fair-indonesia.gitbook.io/docs/developers/guides/measure-a-campaign.md).

# Measure a Campaign

Once a campaign is live, you want to know more than the like count. This guide pulls the raw post engagement, surfaces the comments that actually signal interest or intent, and measures how much of the wider conversation your brand is winning. You start with content engagement, narrow to the comments that matter, then widen out to share-of-voice across the platform. Every call uses the base URL and your raw token in the `Authorization` header (no `Bearer` prefix).

All paths below are relative to the base URL:

* Trial / staging: `https://stg.api.fair-indonesia.com/api/fairservice`
* Production: `https://api.fair-indonesia.com/api/fairservice`

## 1. Pull post engagement with `POST /public-content`

Start with the posts themselves. `POST /public-content` returns the public content for a profile or a single content URL, with engagement counts attached. Use this to track likes, comments, views, and shares on the posts your creators published for the campaign. It works on Instagram, X (formerly Twitter), YouTube and TikTok.

```bash
curl -X POST https://stg.api.fair-indonesia.com/api/fairservice/public-content \
  -H 'Authorization: <your_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "profile_url": "https://x.com/waitin4agi_",
  "work_platform_id": "Twitter WPID",
  "content_type": "ALL",
  "offset": 0
}'
```

Each item in `data` carries an `engagement` object:

```json
{
  "data": [
    {
      "engagement": {
        "like_count": 42134,
        "comment_count": 4234,
        "view_count": 42343,
        "share_count": 42343
      },
      "title": "USA Tours",
      "type": "VIDEO",
      "url": "https://youtu.be/jzWweY4xPe8",
      "published_at": "2021-05-26T00:00:00.000000"
    }
  ]
}
```

Sum the `engagement` fields across the campaign posts to get top-line reach and interaction.

## 2. Find the comments that matter with `POST /comments-relevance`

Raw comment counts hide the signal. `POST /comments-relevance` looks at the comments on a post and scores which ones are actually relevant to your brand, including how many show purchase intent. Submit the content URL, your brand profile URL, and the platform ID. The call returns an `id` for the analysis job.

```bash
curl -X POST https://stg.api.fair-indonesia.com/api/fairservice/comments-relevance \
  -H 'Authorization: <your_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "work_platform_id": "fb83e3ca-eae7-4eaa-bf51-601ea4b3daeb",
  "content_url": "https://example.com/p/your-campaign-post",
  "brand_profile_url": "https://example.com/your-brand"
}'
```

```json
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "content_url": "http://example.com",
  "brand_profile_url": "http://example.com"
}
```

## 3. Poll for the relevance result with `GET /comments-relevance/{id}`

Take the `id` and poll `GET /comments-relevance/{id}` until the report is ready. The `report_information` block breaks down total comments, sentiment counts, and how many comments showed purchase intent — a concrete read on whether the post moved people, not just entertained them.

```bash
curl -X GET https://stg.api.fair-indonesia.com/api/fairservice/comments-relevance/497f6eca-6276-4993-bfeb-53cbbbba6f08 \
  -H 'Authorization: <your_token>'
```

```json
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "status": "SUCCESS",
  "report_information": {
    "total_comment_count": 0,
    "engagement_relevance_score": 0,
    "postive_comment_count": 0,
    "negative_comment_count": 0,
    "neutral_comment_count": 0,
    "purchase_intent_comment_count": 0
  }
}
```

To read the individual scored comments, call `GET /comments-relevance/{id}/comments`, which returns each comment with its `sentiment` and `relevance_score`.

## 4. Measure share-of-voice with `POST /social-listening`

Finally, step back from your own posts and measure the whole conversation. `POST /social-listening` searches public content by `keyword`, `hashtag`, or `mention`, so you can track how much your campaign hashtag or brand name is showing up against competitors. Supported on TikTok, Instagram, YouTube, and X (formerly Twitter). The call returns an `id`.

```bash
curl -X POST https://stg.api.fair-indonesia.com/api/fairservice/social-listening \
  -H 'Authorization: <your_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "work_platform_id": "9bb8913b-ddd9-430b-a66a-d74d846e6c66",
  "hashtag": "yourcampaign",
  "items_limit": 100
}'
```

```json
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "status": "IN_PROGRESS",
  "hashtag": "yourcampaign",
  "items_limit": 100
}
```

## 5. Poll and collect the listening results

First poll `GET /social-listening/{id}` until `status` is `SUCCESS`:

```bash
curl -X GET https://stg.api.fair-indonesia.com/api/fairservice/social-listening/497f6eca-6276-4993-bfeb-53cbbbba6f08 \
  -H 'Authorization: <your_token>'
```

Then pull the matched posts with `GET /social-listening/{id}/fetch`, paging with `limit` and `offset`. Count the matched content and sum its engagement to size your share of the conversation.

```bash
curl -X GET 'https://stg.api.fair-indonesia.com/api/fairservice/social-listening/497f6eca-6276-4993-bfeb-53cbbbba6f08/fetch?limit=100&offset=0' \
  -H 'Authorization: <your_token>'
```

```json
{
  "data": [
    {
      "profile": { "platform_username": "WeatherMumbai", "url": "https://twitter.com/WeatherMumbai" },
      "engagement": { "like_count": 42134, "comment_count": 4234, "view_count": 42343, "share_count": 42343 },
      "type": "REELS",
      "hashtags": [ "yourcampaign" ]
    }
  ],
  "metadata": { "offset": 0, "limit": 10, "count": 0 }
}
```

Put together, you have post-level engagement, the quality of the response in the comments, and how loud your campaign was across the platform.

## Related

* [Content & Comments](/docs/developers/api-reference/content-and-comments.md)
* [Comments Relevance](/docs/developers/api-reference/comments-relevance.md)
* [Social Listening](/docs/developers/api-reference/social-listening.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://fair-indonesia.gitbook.io/docs/developers/guides/measure-a-campaign.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
