Skip to content

S2S Postbacks ​

S2S postbacks (server-to-server postbacks) let you send conversions from your tracker or CRM to Adstat. When a user who came from a Telegram Ads ad completes a target action — signs up or makes a purchase on your website — the tracker sends a request to the Adstat URL, and the event appears in the Statistics section in the Leads and Sales columns. The request goes directly from server to server, without the user's browser.

This guide uses the Keitaro tracker as an example. In Keitaro terms, Adstat acts as a traffic source: the tracker receives clicks from Adstat ads and sends conversions back to Adstat.


How It Works ​

  1. You add a tracker campaign URL with the creative_id={{ad_id}} parameter to your ad. When the ad is created, Adstat replaces {{ad_id}} with the ad ID.
  2. A user clicks the ad in Telegram. The tracker records the click and stores the ad ID.
  3. The user completes a target action on the website. The affiliate network or your CRM reports the conversion to the tracker.
  4. The tracker sends an S2S postback to the Adstat URL with the ad ID and the event type.
  5. Adstat links the event to the ad by its ID and shows it in statistics.

Important

Without the creative_id parameter in the campaign URL, Adstat cannot tell which ad a conversion belongs to. Such an event will not appear in statistics.


Adstat Postback URL ​

The postback URL is on the S2S Postbacks page in the Data Sources section. Click Copy link to copy the base URL.

S2S Postbacks page in Adstat

Adstat accepts postbacks in the following format:

https://postback.adstat.pro/?ad_id=<ad ID>&status=<lead or sale>

For example: https://postback.adstat.pro/?ad_id=12345&status=lead.

In the tracker, replace <ad ID> and <lead or sale> with tracker macros. The tracker substitutes real values when sending the postback. The other parameters from the table below are optional.

URL Parameters ​

ParameterRequiredDescription
ad_idYesThe ad ID received with the click. Used to link the event to the ad
statusYesEvent type: lead — sign-up, sale — purchase. Other values are ignored
tidNoConversion ID in your system. Used to filter out duplicate postbacks
click_idNoClick ID in your tracker. Useful for troubleshooting
event_dateNoDate and time of the event in the source

Event date

If event_date is missing or has an invalid format, the event date is the actual time Adstat received the postback.


Setting Up Keitaro ​

The setup consists of four steps:

  1. Create an Adstat traffic source in Keitaro.
  2. Attach the source to a campaign.
  3. Add the campaign URL to your Adstat ads.
  4. Check that postbacks arrive.

Step 1. Create a Traffic Source ​

A traffic source in Keitaro is a template. It defines which parameters come with a click and where to send conversions. Keitaro has no ready-made Adstat template, so create the source manually.

Creating the Adstat source in Keitaro
  1. In Keitaro, open Sources and click Create.

  2. In the Name field, enter a clear name, for example Adstat (Telegram Ads).

  3. In the S2S postback field, paste the Adstat URL with Keitaro macros:

    https://postback.adstat.pro/?ad_id={creative_id}&status={status}

    This is the minimal version. To also pass the conversion ID, click ID, and event date, use the extended URL:

    https://postback.adstat.pro/?ad_id={creative_id}&status={status}&tid={tid}&click_id={subid}&event_date={conversion_time:Y-m-d H:i:s,UTC}

    The URL uses Keitaro macros. When sending a postback, the tracker replaces them with real values:

    Keitaro macroAdstat parameterValue
    {creative_id}ad_idThe ad ID received with the click
    {status}statusConversion status: lead, sale
    {tid}tidTransaction (conversion) ID
    {subid}click_idClick ID in Keitaro
    {conversion_time:Y-m-d H:i:s,UTC}event_dateConversion date and time in UTC

    Only ad_id and status are required. You can remove the optional parameters if you don't need them.

  4. In the Send only statuses field, select lead and sale. Adstat ignores other statuses (rejected, rebill), so there is no need to send them.

  5. In the Parameters block, find the Creative ID row and fill it in:

    Name (1st column)Parameter (2nd column)Value (3rd column)
    Adcreative_id{{ad_id}}
    • In the second column, keep creative_id (the default): the parameter is added to the campaign URL under this name.
    • In the third column, enter {{ad_id}}: an Adstat macro. When the ad is created, Adstat replaces it with the actual ad ID.

    Keitaro stores the received value as the click's Creative ID and returns it in the postback via the {creative_id} macro.

  6. Click Save.

Step 2. Attach the Source to a Campaign ​

Source field in Keitaro campaign settings
  1. Open the campaign settings in Keitaro.

  2. In the Source field, select the Adstat (Telegram Ads) source you created.

  3. Keitaro automatically adds the source parameters to the Campaign URL. It will look similar to this:

    https://your-tracker-domain.com/AbCdEf?creative_id={{ad_id}}
  4. Save the campaign and copy the campaign URL.

TIP

Once the source is selected, the S2S postback to Adstat is attached to the campaign automatically. You don't need to add it separately in the S2S Postbacks tab.

Step 3. Add the Campaign URL to Your Adstat Ads ​

  1. In Adstat, create an ad or open an existing one.

  2. In the Channel, bot, or website URL field, paste the Keitaro campaign URL from Step 2.

  3. Make sure the URL contains the creative_id={{ad_id}} parameter. You can type it manually or add it in the Promoted URL with parameters window: set the creative_id parameter to {{ad_id}} and click Insert into the ad.

    Promoted URL with parameters window with the creative_id parameter

    After that, the ad URL will contain the parameter:

    Ad URL with the creative_id parameter in Adstat
  4. Save the ad. Adstat replaces {{ad_id}} with the ad ID — after creation, the URL will contain, for example, creative_id=12345.

You can use the same campaign URL in all ads: each ad gets its own ID.

Learn more about creating ads in the Ads section.

Important

  • Changing the URL in an ad sends it back to moderation.
  • The URL must be complete, starting with https://. URL shorteners are not allowed by Telegram Ads rules.
  • Postbacks only work for clicks made after the URL with the creative_id parameter was added to the ad.

Step 4. Check That Postbacks Arrive ​

S2S postbacks log in Keitaro
  1. Follow the ad URL and complete a test target action — or wait for the first real conversion.
  2. In Keitaro, open Maintenance → Logs → S2S postbacks. The log shows which URL the conversion was sent to and what response Adstat returned.
  3. Make sure the macros in the sent URL were replaced with values: ad_id contains the ad ID, and status is lead or sale.
  4. Open the Statistics section in Adstat, select the By ads breakdown, and enable the Leads and Sales columns using the gear icon.

How Events Are Counted ​

  • Leads — the number of postbacks with the lead status.
  • Sales — the number of postbacks with the sale status.
  • Postbacks with other statuses are ignored.
  • If tid is passed, repeated postbacks with the same conversion ID are not counted twice. Pass tid if your tracker may resend the same conversion.
  • An event is counted in statistics by the date from event_date. If the parameter is missing or has an invalid format, the actual time the postback was received is used.
  • Statistics in Adstat are shown in the UTC time zone.

If Conversions Don't Appear in Statistics ​

Keitaro doesn't send the postback

  • Check that the Adstat source is selected in the campaign settings.
  • Check that the Send only statuses field in the source settings includes the status of the conversion received by the tracker.
  • Check the log: Maintenance → Logs → S2S postbacks.

The postback URL has an empty ad_id, or {creative_id} instead of a value

  • Check that the Adstat ad uses the campaign URL with the creative_id parameter, and that after the ad was created it contains the ad ID rather than an empty value.
  • Check that in the source parameters, the Creative ID row has creative_id in the second column and {{ad_id}} in the third.
  • Open the click log in Keitaro, add the Creative ID column, and make sure the value arrives with the click.

The postback was sent, but the event isn't visible in Adstat

  • Check the status value: only lead and sale are counted.
  • Check that ad_id in the postback matches the ad ID in Adstat.
  • Check the statistics filters: the period, account, and advertising object must include the ad.
  • If the event landed on the wrong day, check event_date: with an invalid format, the event date becomes the time the postback was received.