Skip to main content

Callbacks - What they are and how to use them

Curious what callbacks are and how they can be used? This article will explain what they are and how you can make use of the functionality

Pelle Söderman avatar
Written by Pelle Söderman
Updated this week

What are callbacks?

A callback is essentially a method of getting sent transaction data when a transaction has been registered in your Adtraction account. Technically speaking a callback is a URL request our servers make towards the URL where you want to receive the requested data. This allows you to gather specific data in one place rather than logging in to several different platforms.

This functionality is commonly used in conjunction with EPI, allowing for instance, a cashback site or a subnetwork to attribute a transaction to the correct party as soon as it is tracked by Adtraction.

You can flexibly setup to receive a callback when a transaction happens for channel x and advertiser y.

The data you want to receive is populated into the callback URL with tokens.

Setup callbacks

To set up a Callback follow these steps after signing in to your Adtraction account.

  1. Navigate to Tools in the left menu, then select Callbacks

  2. Enter the URL to where you want to receive the callback (your secure endpoint).

  3. Add any available variables to your callback URL as parameters to specify the data you wish to receive.

  4. Choose what channels and brands you want your callback to apply to.

  5. Click on “Create new callback”.

Your callback is now created and whenever a transaction is registered that matches the advertiser and channel you’ve selected, we will trigger a request allowing you to record the data on your end.

Example URL

This is an example of how your URL could look like, using variables to pass data:

https://www.example.com/?date=${actiondate}&commission=${commissiondecimal}&transactionstatus=${status}&currency=${currency}&brand=${programname}&link=${epi}

Status of callbacks

Callbacks will have different statuses, which indicate the current state of your callback URL and its history of successful or failed executions.

  • New: This is the initial status when a callback is first created. The callback has been saved but has not yet been triggered by a transaction.

  • OK: This status indicates a successful execution of the callback. This means Adtraction's server was able to connect to your designated URL and received a successful HTTP response code (e.g., 200 OK, 201 Created, or 202 Accepted).

  • Error + HTTP Code: This status indicates that the callback failed to execute successfully. The HTTP Code will be replaced by the specific HTTP status code returned by your server (e.g., Error 400, Error 404, Error 500). This usually means there was a problem with the URL, your server, or a temporary network issue.

  • Deactivated: A callback will be automatically set to this status after 20 or more consecutive failures. To protect the performance and stability of our system and your server, the callback will be disabled, and Adtraction will stop attempting to send transaction data to that URL.

If your callback has been deactivated, you must first correct the issue on your server (e.g., fix the endpoint URL or resolve server errors). After making corrections, you can activate the callback again by clicking on Activate. If you need to make any changes on the callback url, simply delete it and create a new one.

Available variables

Variable

Description

Type

Example

${actiondate}

Time of transaction in UnixTime

Integer

1297461346

${advertid}

Ad ID

Integer

183353283

${channelid}

Channel ID

Integer

163456083

${channelname}

Channel name

String

My Channel

${cid}

Client ID (Google Analytics)

String

415065613.1634041445

${clickdate}

Time of click in UnixTime

Integer

1297461346

${commissiondecimal}

Commission

Decimal

12.50

${commissiontypeid}

Transaction type ID (as specified in the Commissions table on each Program page)

Integer

1118219169

${commission}

Commission in cents (EUR 12.50 equals 1250)

Integer

1250

${currency}

Currency

String

EUR

${epi2}

EPI2-value

String

My EPI2

${epi3}

EPI3-value

String

My EPI3

${epi4}

EPI4-value

String

My EPI4

${epi5}

EPI5-value

String

My EPI5

${epi}

EPI-value

String

My EPI

${gclid}

Google Click Identifier (Google Ads)

String

EAIaIQobChMIibbtyOXT7QIVAmgYCh3e4ghoEAAYAyAAEgLp-vD_BwE

${ordervaluedecimal}

Total order amount

Decimal

12.50

${ordervalue}

Total order amount in cents (EUR 129.50 equals 12950)

Integer

12950

${programid}

Program ID

Integer

123453083

${programname}

Advertiser name

String

Brand name

${status}

Status for transaction (1 = pending, 0 = approved)

Integer

1

${transactionname}

Transaction name

String

Sale

${transactiontype}

Type of transaction (sale, lead)

String

sale

${uniqueid}

Transaction unique ID

String

753be5c4-c116-4d62-a1fa-b30f81a3563f

Did this answer your question?