24metrics API Integration (1)

Introduction

24metrics API Integration Docs

Welcome to the 24metrics API Integration documentation.

This API allows you to:

  • Detect fraud in your clicks or impressions - particularly useful when our JavaScript SDK cannot be implemented.
  • Detect fraud in your conversions.

24metrics provides advanced click fraud detection for your marketing campaigns, helping you:

  • Identify and block fraudulent traffic
  • Get detailed analytics on your campaigns
  • Improve ROI by focusing on quality traffic

Our API is designed to be simple to integrate while providing powerful fraud detection capabilities.

Quick Start Guide

Getting started with the 24metrics API is straightforward:

  1. Get your Integration ID from your 24metrics dashboard.
  2. Create your first request:
curl -X GET "https://YOUR_INTEGRATION_ID.clicks.24metrics.com/?no_redirect=true&offer=campaign123&publisher=affiliate456"
{
  "transaction_id": "01F3XYZ123ABC",
  "status": "approved"
}

Sending Browser Data to our Backend Server

Browser Data for Enhanced Fraud Detection

With our JavaScript Integration from the Browser, we are able to get important information for enchanced fraud detection from the user's browser such as fingerprint data, unique user id data, incongnito detection, bot detection, browser timezone and more.

If the API call is coming from a backend server, it is possible to pass the browser information to our endpoint by doing the following instructions here.

JavaScript Code

You have to add our JavaScript data generator code in to your web app or web page code to add its generated data to the click event sent to your backend server. This is an example how our function can be used to generate the data from an HTML page.

<script src="https://cdn.24metrics.com/lib/index.js">
  jsData = await ASP.get24metricsData()
  console.log(jsData) // send this data to your backend server
</script>

Then, you must pass this data to our endpoint in the js_check_data query parameter.

Here is a curl representation of the API call that must be executed:

curl -X GET "https://YOUR_INTEGRATION_ID.clicks.24metrics.com/?no_redirect=true&offer=campaign123&publisher=affiliate456&js_check_data=JS_CHECK_DATA"
{
  "transaction_id": "01F3XYZ123ABC",
  "status": "approved"
}

Summary

  • The JavaScript code is used and collects browser data.
  • Your server receives this data from the browser.
  • Your server forwards the data to 24metrics using the js_check_data parameter.

Create Click

Create a click using the API. This is useful for integrations that do not support the 24metrics JS SDK.

Create a Click using the API.

query Parameters
fields
string (Fields)

A list of response fields that you want to appear in the response object. Separate by comma: monitoring_mode, filter_group_id, rejections, is_bot, proxy_type, redirect_url, ip, country, city, isp, asn, fingerprint, uuid

click_ip
string (ClickIP)

The real of ip of the user that made the click. By default, the server request IP is used.

offer
string (Offer)

The offer or campaign identifier. E.g. the value of utm_campaign

advertiser
string (Advertiser)

The advertiser identifier. E.g. the value of utm_medium

publisher
string (Publisher)

The affiliate identifier. E.g. the value of utm_source

sub_id
string (SubID)

The affiliate sub ID source. The system may implement high cardinality control for this field which will result with an override value of TOO_MANY_UNIQUE_SUB_ID.

sub_id_2
string (SubID2)

The affiliate sub ID 2 source.

sub_id_3
string (SubID3)

The affiliate sub ID 3 source.

sub_id_4
string (SubID4)

The affiliate sub ID 4 source.

sub_id_5
string (SubID5)

The affiliate sub ID 5 source.

user_agent
string (UserAgent)

The browser's user agent. This is taken from the HTTP headers by default.

referer
string (Referer)

The Referer URL of the click.

keyword
string (Keyword)

For search campaigns. This is used in Keyword Filtering. E.g. the value of utm_term

js_check_data
string

(Recommended if click is done from the browser) In base64 format. The output of the 24metrics JS SDK code ASP.get24metricsData() function. It provides important information for enhanced fraud detection. See How to Send Browser Data.

secure_code
string

If you enabled the Click Secure Code feature, pass the secure code here.

device_id
string (DeviceID)

The user device id. This can be the Google AID or Apple IDFA. This is used for Device ID validation filtering.

external_transaction_id
string (ExternalTxID)

If the source of the click is coming from an affiliate tracking platform, pass the transaction ID here.

click_time
number

The click time in UTC UNIX time format. If not passed, the current time in UTC is used. This time must not be in the future

Responses

Response Schema: application/json
transaction_id
string

The transaction id. You can use this to find the data from the Reports.

status
string
Enum: "rejected" "approved"

The result of the fraud detection.

reason
string

If status is rejected, this is the primary reason why. Please note that the reasons from the Reports Pages are renamed for humans. You can find the full list of reasons at https://help.24metrics.com/en/api-documentation#fraud-detection-reasons

Response samples

Content type
application/json
{
}

Create Impression

Create an impression using the API. This is useful for integrations that do not support the 24metrics JS SDK.

Create an Impression using the API.

query Parameters
impression_ip
string (ImpressionIP)

The real ip of the user that made the impression. By default, the server request IP is used.

offer
string (Offer)

The offer or campaign identifier. E.g. the value of utm_campaign

advertiser
string (Advertiser)

The advertiser identifier. E.g. the value of utm_medium

publisher
string (Publisher)

The affiliate identifier. E.g. the value of utm_source

sub_id
string (SubID)

The affiliate sub ID source. The system may implement high cardinality control for this field which will result with an override value of TOO_MANY_UNIQUE_SUB_ID.

sub_id_2
string (SubID2)

The affiliate sub ID 2 source.

sub_id_3
string (SubID3)

The affiliate sub ID 3 source.

sub_id_4
string (SubID4)

The affiliate sub ID 4 source.

sub_id_5
string (SubID5)

The affiliate sub ID 5 source.

user_agent
string (UserAgent)

The browser's user agent. This is taken from the HTTP headers by default.

referer
string (Referer)

The Referer URL of the click.

keyword
string (Keyword)

For search campaigns. This is used in Keyword Filtering. E.g. the value of utm_term

js_check_data
string

(Recommended if click is done from the browser) In base64 format. The output of the 24metrics JS SDK code ASP.get24metricsData() function. It provides important information for enhanced fraud detection. See How to Send Browser Data.

secure_code
string

If you enabled the Click Secure Code feature, pass the secure code here.

device_id
string (DeviceID)

The user device id. This can be the Google AID or Apple IDFA. This is used for Device ID validation filtering.

external_transaction_id
string (ExternalTxID)

If the source of the click is coming from an affiliate tracking platform, pass the transaction ID here.

impression_time
number

The impression time in UTC UNIX time format. If not passed, the current time in UTC is used. This time must not be in the future

Responses

Response Schema: application/json
transaction_id
string

The transaction id. You can use this to find the data from the Reports.

status
string
Enum: "rejected" "approved"

The result of the fraud detection.

reason
string

If status is rejected, this is the primary reason why. Please note that the reasons from the Reports Pages are renamed for humans. You can find the full list of reasons at https://help.24metrics.com/en/api-documentation#fraud-detection-reasons

Response samples

Content type
application/json
{
}

Create Conversion

Create a conversion using the API.

Create a Conversion using the API.

query Parameters
secure_code
required
string

The conversion authentication secure code.

offer
string (Offer)

The offer or campaign identifier. E.g. the value of utm_campaign

advertiser
string (Advertiser)

The advertiser identifier. E.g. the value of utm_medium

publisher
string (Publisher)

The affiliate identifier. E.g. the value of utm_source

sub_id
string (SubID)

The affiliate sub ID source. The system may implement high cardinality control for this field which will result with an override value of TOO_MANY_UNIQUE_SUB_ID.

user_agent
string (UserAgent)

The browser's user agent. This is taken from the HTTP headers by default.

conversion_ip
string

The user IP of the conversion. By default, the HTTP client IP is used.

click_ip
string (ClickIP)

The real of ip of the user that made the click. By default, the server request IP is used.

external_transaction_id
string (ExternalTxID)

If the source of the click is coming from an affiliate tracking platform, pass the transaction ID here.

conversion_time
required
number

The conversion time in UNIX time format. This is required if use_current_time is not used.

use_current_time
boolean

If set to true, use the current time as the conversion time.

click_time
number

The click time in UTC UNIX time format. If not passed, the current time in UTC is used. This time must not be in the future

session_time
number

The duration from click time to conversion time in seconds. Do not use this if click_time is used.

server_ip
string

By default, server_ip is the HTTP client IP that we received. Use this to change that.

purchase_value
number <float>

Purchase value of an item

revenue
number <float>

Revenue value

payout
number <float>

Affiliate payout value

app_id
string

(Optional) Pass in valid iOS or Android ID format. Useful for app version filtering.

app_version
string

(Optional) Pass in valid iOS or Android version format. Useful for app version filtering.

begin_install_time
string

(Optional) UNIX Time format. For tracking install timing with finish_install_time. Useful for session time related filters.

finish_install_time
string

(Optional) UNIX Time format. For tracking install timing begin_install_time. Useful for session time related filters.

third_party_rejected_reason
string

Use this if the conversion has an associated non-24metrics rejection reason for tracking purposes.

Responses

Response Schema: application/json
transaction_id
string

The transaction id. You can use this to find the data from the Reports.

status
string
Enum: "rejected" "approved"

The result of the fraud detection.

reason
string

If status is rejected, this is the primary reason why. Please note that the reasons from the Reports Pages are renamed for humans. You can find the full list of reasons at https://help.24metrics.com/en/api-documentation#fraud-detection-reasons

Response samples

Content type
application/json
{
}