Skip to main content
Version: 24.05

/i/campaign/postback

Enterprise

This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.

Endpoint​

/i/campaign/postback

Overview​

Receives an install postback for a campaign, matches it to an app user, records the click and install metrics, saves the attribution on the user, and forwards the data to the campaign's configured postbacks.

Authentication​

  • No API key or token is required. The campaign is identified by cly_id.

Permissions​

  • None. The endpoint is meant to be called by attribution partners or SDKs.

Request Parameters​

ParameterTypeRequiredDescription
cly_idStringYesCampaign ID.
aid_<name>StringConditionalAdvertising identifier (for example aid_idfa). Used to find the app user whose aid.<name> matches. Required if neither advertising_id nor idfa is provided.
click_urlStringNoLink the user clicked. Stored as the referrer. For Countly tracking links (path starting with /at/), its query parameters are also read.
click_timestampStringNoTime of the click; used as the event timestamp and stored as last_click.
advertising_idStringConditionalLegacy Android attribution. Used when no aid_ parameter is given. The app user is derived from this ID. Not stored as a segment.
idfaStringConditionalLegacy iOS attribution. Used when no aid_ parameter and no advertising_id is given. Must match the MD5 hash of the user's Countly device ID.
device_idStringNoDevice ID. Not stored as a segment. With advertising_id, it defaults to the advertising ID.
adidStringNoIgnored. Not stored as a segment.
Other parametersStringNoAny other non-empty parameter is stored on the user's attribution record and recorded as a segment.

At least one identifier is required: an aid_<name> parameter, advertising_id or idfa.

Examples​

Example 1: Server-to-server postback​

/i/campaign/postback?cly_id=campaign-summer-2026&aid_idfa=ABCDEF12-3456-7890-ABCD-EF1234567890&click_timestamp=1767225600

This succeeds only if an app user already has a matching aid.idfa value. Identifier values are lowercased before matching, so the stored value must be lowercase. Otherwise the endpoint returns 404 User Not Found.

Response​

Success Response​

{
"result": "Success"
}

Response Fields​

FieldTypeDescription
resultStringResult message.

Error Responses​

Status Code: 404 Not Found

{
"result": "Campaign Not Found"
}

Status Code: 404 Not Found

{
"result": "App Not Found"
}

Status Code: 404 Not Found

{
"result": "User Not Found"
}

Behavior​

  1. Finds the campaign by cly_id, then its app.
  2. If the app has a redirect URL configured, the request is forwarded there (as POST with the body when the request was a POST, otherwise GET) and nothing else happens in Countly.
  3. Collects aid_ identifiers and other parameters from the request, and from click_url when it is a Countly tracking link.
  4. Finds the app user by advertising identifier (aid.<name>). When no aid_ parameter is given, uses advertising_id (Android) or, failing that, idfa (iOS). For aid_ matches, a matching stored click is read for extra segments and removed.
  5. Records aclk and ins (click and install) metrics for the campaign, stores the attribution data on the user under cmp, sends the data to each configured campaign postback, and returns Success.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.campaignsCampaign storageReads the campaign and its postbacks.
countly.appsApp lookupReads the app and its redirect URL.
countly.app_users{appId}User matchingFinds the user and saves attribution under cmp.
countly.attributionClick fingerprintsReads and removes a matching click record.
countly.campaign_users{appId}Campaign usersReads the click user for extra segments.
countly.campaigndataCampaign metricsRecords click and install metrics.