1. Hang My Tracking API V1 Documentation

Hang My Tracking API

Methods Available

Getting Started

To get started, request your API ID and API Token. In all requests to the API, the ID and the Token must be provided. You can talk to your Account Manager about creating and obtaining your API Key. On the left menu you can check the details of the available methods.



Requirements:

  • API ID and Token are required.
  • IP addresses making the requests must be submitted to the white-list for API access.
  • All API requests must use the POST method.
  • There's a Rate Limiting of 20 API calls for every 10 seconds. This is a requirement to prevent attacks.
Sample API request (PHP)

No matter the method you want to call, the base URL is always the same (http://api.hangmytracking.com/api.php). Then you have to define the parameters of each request. The parameters required are method, apiToken and apiID. Then depending on the method you can apply filters to your query. In the example bellow, details about offer ID 42 are being requested. Finally just make a POST request and a json object with your response will be returned.

< ? php
function httpPost($url,$params)
{
    $postData = http_build_query($params);
 
    $ch = curl_init();  
 
    curl_setopt($ch,CURLOPT_URL,$url);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch,CURLOPT_HEADER, false); 
    curl_setopt($ch, CURLOPT_POST, count($postData));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);    
 
    $output=curl_exec($ch);
 
    curl_close($ch);
    return $output;
 
}

$base_url = 'http://api.hangmytracking.com/api.php';

$parameters = array(
    'method' => 'getOffers'
    ,'apiToken' => API_KEY
    ,'apiID' => NETWORK_ID
    ,'filters[idOffer]' => array('25156')
    ,'epc' => 1
);

$response = json_decode(httpPost($base_url,$parameters));
?>
Sample API Response

API responses are pretty straight forward, you get a json object with the status (OK or NOK), the number of errors and a description of each error. If there are no errors then the data will have the total of records returned and the details of all the records.

stdClass Object
(
    [status] => OK
    [data] => stdClass Object
        (
            [total_records] => 1
            [offers] => Array
                (
                    [0] => stdClass Object
                        (
                            [id] => 25156
                            [name] => GB 2445 Incent/Android/Private/Direct/CPA/DT - PokerStars
                            [conversion_type] => serverpostback
                            [conv_default_status] => approved
                            [allow_duplicates] => 0
                            [require_approval] => 1
                            [approved] => 1
                            [tracking_link] => https://tracking.hangmytracking.com/click.php?oid=25156&aid=aff_id&subid=YOUR_CLICK_ID&type=YOUR_SUB_SOURCE&google_aid=REPLACE_WITH_GAID&ios_ifa=REPLACE_WITH_IDFA
                            [description] => Install, Register & Deposit. £20 free play when you first deposit £10 with code TWENTY. New Players only and 21+ yrs old.
                            [conditions] => Requires Android 5.0 or higher.
                            [daily_cap] => 50
                            [cap_timezone] => (GMT+00:00)
                            [monthly_cap] => 500
                            [blocked_sources] => Array
                                (
                                    [0] =>  123_abc
                                    [1] =>  987_zxy
                                )

                            [categories] =>  Incent, CPA, Direct, Android, Private, DT
                            [categoriesID] =>  6, 21, 17, 7, 16, 23
                            [countries] =>  GB
                            [countries_name] =>  United Kingdom
                            [start_date] => 2020-01-01 08:00:00
                            [expiration_date] => 2025-04-14 00:30:00
                            [status] => active
                            [preview_URL] => https://play.google.com/store/apps/details?id=com.pokerstars.uk&gl=UK
                            [payout_cents] => 5000
                            [pay_type] => CPA
                            [pay_curr] => USD
                            [thumbnail] => https://banners.hangmyads.com/files/uploads/Off_A_23074.png
                            [epc] => 7.06
                            [package] => com.pokerstars.uk
                            [os] => Android
                            [devices] => All    
                            [categories_obj] => stdClass Object
                                (
                                    [6] => Incent
                                    [21] => CPA
                                    [17] => Direct
                                    [7] => Android
                                    [16] => Private
                                    [23] => DT
                                )

                            [countries_obj] => stdClass Object
                                (
                                    [GB] => United Kingdom
                                )

                            [goals] => Array
                                (
                                    [0] => stdClass Object
                                        (
                                            [first deposit] => stdClass Object
                                                (
                                                    [pay_type] => CPA
                                                    [pay_cents] => 5000
                                                    [pay_currency] => USD
                                                )

                                        )
                                    [1] => stdClass Object
                                        (
                                            [completed_registration] => stdClass Object
                                                (
                                                    [pay_type] => CPA
                                                    [pay_cents] => 0
                                                    [pay_currency] => USD
                                                )

                                        )

                                )

                        )

                )

        )

    [errors] => 0
    [errorMessages] => Array
        (
        )

)
Method

getCategories

Description

Get all the Category types available on the platform and their respective IDs. It's particulary helpfull to filter offers by category ID.

Parameters
Name Data Type Description Required
idCategory Array of Integer An array with the IDs of the categories you want. If empty all categories will be returned No
Response

A categories object containing the category names requested.

Example Code (PHP)
Get the categories with IDs 6, 7 and 8.
< ? php

    $baseURL = 'http://api.hangmytracking.com/api.php';

    $parameters = array(
        'method' => 'getCategories'
        ,'apiToken' => API_KEY
        ,'apiID' => NETWORK_ID
        ,'filters[idCategory]' => array(6,7,8)
    );

    $postData = http_build_query($parameters);
    
    $ch = curl_init();  
    curl_setopt($ch,CURLOPT_URL,$baseURL);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch,CURLOPT_HEADER, false); 
    curl_setopt($ch, CURLOPT_POST, count($postData));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);    
    $output=curl_exec($ch);
    curl_close($ch);

    $response = json_decode($output);
?>
Method

getConversionDetails

Description

Get the details of the Conversions made between a range of dates.

Parameters
Name Data Type Description Required
start_date Date Time The start date of the range. Format is YYYY-MM-DD hh:mm:ss Yes
end_date Date Time The end date of the range. Format is YYYY-MM-DD hh:mm:ss Yes
offset Integer Timezone offset to GMT in MINUTES. For example, for Eastern US Timezone send -300 (-5hours*60minutes). No
fields Array An array with the fields wanted as the keys and "on" as value. Possible fields are offer_id, offer, affiliate_id, affiliate, ad_name, url_name, goal_name, conv_time, payout, currency, click_id, id, affiliate_source, affiliate_subid, affiliate_subid2, affiliate_subid2, affiliate_subid3, affiliate_subid4, affiliate_subid5, aff_custom, click_ip, is_duplicated, country_name, browser, device_type, device_brand, device_model, device_os, device_os_version, device_id, android_id, mac_address, ios_ifa, google_aid Yes at least one
filters Array An array of parameters where the Key should be the name of the field to filter by and the value the ID of the field. Possible keys of the array are offer_id and ad_id. No
limit Integer The number of items returned per page. No
page Integer Page by the limit of times returned. Defaults is the first page. No
sort String Sort by one of the fields allowed. No
sortby String If sort is used, ascending or descending can be choosen here by sending ASC or DESC in the sortby parameter. No
format String A string with the format of the response. At this moment, all results will be in json so this parameter can be ignored. No
Response

An array of Conversion objects containing the conversion fields requested.

Example Code (PHP)
Get conversion time and affiliate subID of the 10 conversions on page 2 (11th to 20th) from offer 182 made on the 8th of January between midnight PST (GMT -8:00) and 1pm PST sorted by conversion time from the most recent to the oldest and return the result in json format.
< ? php

    $baseURL = 'http://api.hangmytracking.com/api.php';

    $parameters = array(
            'method' => 'getConversionDetails'
            ,'apiToken' => API_KEY
            ,'apiID' => NETWORK_ID
            ,'offset' => -8*60
            ,'sort' => 'conv_time'
            ,'sortby' => 'desc'
            ,'limit' => 10
            ,'page' => 2
            ,'format' => 'json'
            ,'start_date' => '2015-01-08 08:00:00'
            ,'end_date' => '2015-01-08 21:00:00'
            ,'filters[offer_id]' => array(182)
            ,'fields[conv_time]' => 'on'
            ,'fields[affiliate_subid]' => 'on'
    );

    $postData = http_build_query($parameters);
    
    $ch = curl_init();  
    curl_setopt($ch,CURLOPT_URL,$baseURL);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch,CURLOPT_HEADER, false); 
    curl_setopt($ch, CURLOPT_POST, count($postData));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);    
    $output=curl_exec($ch);
    curl_close($ch);

    $response = json_decode($output);
?>
Method

getOffers

Description

Find offers and get details on them.

Parameters
Name Data Type Description Required
filters Array
KeyValue
idOfferAn array with Offer IDs to filter by
countryAn array with Country Codes to filter by
categoryAn array with Category IDs to filter by
No
epc Integer 1 if you wish to receive the current campaign EPC 0 if it's not required No
limit Integer The number of items returned per page. No
page Integer Page by the limit of times returned. Defaults is the first page. No
sort String Sort by one of the fields allowed. No
sortby String If sort is used, ascending or descending can be choosen here by sending ASC or DESC in the sortby parameter. No
format String A string with the format of the response. At this moment, all results will be in json so this parameter can be ignored. No
Response

An array of Offer objects containing the offer details.

Example Code (PHP)
Get the 25 most recent iOS or Android offers for United Kingdom or India and return the result in json format.

You can check the home page for a sample response of getOffers call

< ? php

    $baseURL = 'http://api.hangmytracking.com/api.php';

    $parameters = array(
            'method' => 'getOffers'
            ,'apiToken' => API_KEY
            ,'apiID' => NETWORK_ID
            ,'sort' => 'start_date'
            ,'sortby' => 'desc'
            ,'limit' => 25
            ,'page' => 1
            ,'format' => 'json'
            ,'filters[country]' => array('GB','IN')
            ,'filters[category]' => array(7,8)
    );

    $postData = http_build_query($parameters);
    
    $ch = curl_init();  
    curl_setopt($ch,CURLOPT_URL,$baseURL);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch,CURLOPT_HEADER, false); 
    curl_setopt($ch, CURLOPT_POST, count($postData));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);    
    $output=curl_exec($ch);
    curl_close($ch);

    $response = json_decode($output);
?>
Method

getOfferStatus

Description

Get details of the reason for status of an offer, like if it's paused due to reaching the cap and it will come back.

Parameters
Name Data Type Description Required
offerID Integer The ID of the Offer which more details of its status is being requested. Yes
Response

An objects with the details of the status of the offer.

Example Code (PHP)
Why is offer 19517 paused?
< ? php

    $baseURL = 'http://api.hangmytracking.com/api.php';

    $parameters = array(
            'method' => 'getOfferStatus'
            ,'apiToken' => API_KEY
            ,'apiID' => NETWORK_ID
            ,'offerID' => 19517
    );

    $postData = http_build_query($parameters);
    
    $ch = curl_init();  
    curl_setopt($ch,CURLOPT_URL,$baseURL);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch,CURLOPT_HEADER, false); 
    curl_setopt($ch, CURLOPT_POST, count($postData));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);    
    $output=curl_exec($ch);
    curl_close($ch);

    $response = json_decode($output);
?>
Method

getOfferAds

Description

Get Ad details from one or more offers.

Parameters
Name Data Type Description Required
filters Array An array of parameters where the Key should be the name of the field to filter by. Most fields can be used but only n_idOffer is mandatory. Yes, an offer ID is required in the n_idOffer filter parameter
Response

An array of Ads objects containing the ad details.

Example Code (PHP)
Get all 300x250 Banners (type=1) from offers 197 and 198.
< ? php

    $baseURL = 'http://api.hangmytracking.com/api.php';

    $parameters = array(
            'method' => 'getOfferAds'
            ,'apiToken' => API_KEY
            ,'apiID' => NETWORK_ID
            ,'filters[n_idOffer]' => array(197,198)
            ,'filters[n_idAd_type]' => array(1)
            ,'filters[width]' => array(300)
            ,'filters[height]' => array(250)
    );

    $postData = http_build_query($parameters);
    
    $ch = curl_init();  
    curl_setopt($ch,CURLOPT_URL,$baseURL);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch,CURLOPT_HEADER, false); 
    curl_setopt($ch, CURLOPT_POST, count($postData));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);    
    $output=curl_exec($ch);
    curl_close($ch);

    $response = json_decode($output);
?>
Method

getOfferURLs

Description

Get URL details from one or more offers. URL named default is already specified in the offer details but it's possible to have more than one landing page in the offer.

Parameters
Name Data Type Description Required
filters Array An array of parameters where the Key should be the name of the field to filter by. Yes, an offer ID is required in the n_idOffer filter parameter
Response

An array of URL objects containing the URL details.

Example Code (PHP)
Get all URLs from offers 160, 161 and 162.
< ? php

    $baseURL = 'http://api.hangmytracking.com/api.php';

    $parameters = array(
            'method' => 'getOfferURLs'
            ,'apiToken' => API_KEY
            ,'apiID' => NETWORK_ID
            ,'filters[n_idOffer]' => array(160,161,162)
    );

    $postData = http_build_query($parameters);
    
    $ch = curl_init();  
    curl_setopt($ch,CURLOPT_URL,$baseURL);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch,CURLOPT_HEADER, false); 
    curl_setopt($ch, CURLOPT_POST, count($postData));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);    
    $output=curl_exec($ch);
    curl_close($ch);

    $response = json_decode($output);
?>
Method

getOfferTargeting

Description

Get Target details from one or more offers.

Parameters
Name Data Type Description Required
filters Array An array of parameters where the Key should be the name of the field to filter by. Only n_idOffer filter is required but it can also be filtered by type of target and action. Yes, an offer ID is required in the n_idOffer filter parameter
Response

An array of Target objects containing the target details.

Example Code (PHP)
Get Geo target from offers 23, 156, 162 and 172.
< ? php

    $baseURL = 'http://api.hangmytracking.com/api.php';

    $parameters = array(
            'method' => 'getOfferTargeting'
            ,'apiToken' => API_KEY
            ,'apiID' => NETWORK_ID
            ,'filters[n_idOffer]' => array(23,156,162,172)
            ,'filters[type]' => array('Geo')
            ,'filters[action]' => array('Allow')
     );

    $postData = http_build_query($parameters);
    
    $ch = curl_init();  
    curl_setopt($ch,CURLOPT_URL,$baseURL);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch,CURLOPT_HEADER, false); 
    curl_setopt($ch, CURLOPT_POST, count($postData));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);    
    $output=curl_exec($ch);
    curl_close($ch);

    $response = json_decode($output);
?>
Method

getFinancialReport

Description

Get a detailed Financial report of the offers.

Parameters
Name Data Type Description Required
start_date Date The start date of the range. Format is YYYY-MM-DD Yes
end_date Date The end date of the range. Format is YYYY-MM-DD. The difference between start and end date to be bigger than 3 days. Yes
offset Integer Timezone offset to GMT in MINUTES. For example, for Eastern US Timezone send -480 (-8hours*60minutes). No
fields Array An array with the fields wanted as the keys and "on" as value. Possible fields are offer_id, offer, publisher, zero_rev, rev_type, rev_cents, year, month, week, day, revenue, rpa, installs, currency, storeid Yes at least one
filters Array An array of parameters where the Key should be the name of the field to filter by and the value the ID of the field. There is only one possible key of the array here and it's offer_id. No
limit Integer The number of items returned per page. No
page Integer Page by the limit of times returned. Defaults is the first page. No
sort String Sort by one of the fields requested but it has to be requested. No
sortby String If sort is used, ascending or descending can be choosen here by sending ASC or DESC in the sortby parameter. No
format String A string with the format of the response. At this moment, all results will be in json so this parameter can be ignored. No
Response

An array of Stats objects containing the stats report requested.

Example Code (PHP)
Get payout and conversions grouped by day from the top 10 most profitable offers from the first 5 days of January using central europe timezone and return the result in json format.
< ? php

    $baseURL = 'http://api.hangmytracking.com/api.php';

    $parameters = array(
            'method' => 'getFinancialReport'
            ,'apiToken' => API_KEY
            ,'apiID' => NETWORK_ID
            ,'offset' => 60
            ,'limit' => 10
            ,'page' => 1
            ,'format' => 'json'
            ,'sort' => 'payout'
            ,'sortby' => 'desc'
            ,'start_date' => '2021-01-01'
            ,'end_date' => '2021-01-05'
            ,'fields[offer]' => 'on'
            ,'fields[installs]' => 'on'
            ,'fields[publisher]' => 'on'
            ,'fields[revenue]' => 'on'
            ,'fields[day]' => 'on'
            ,'fields[storeid]' => 'on'
    );

    $postData = http_build_query($parameters);
    
    $ch = curl_init();  
    curl_setopt($ch,CURLOPT_URL,$baseURL);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch,CURLOPT_HEADER, false); 
    curl_setopt($ch, CURLOPT_POST, count($postData));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);    
    $output=curl_exec($ch);
    curl_close($ch);

    $response = json_decode($output);
?>
Method

getPrintsReport

Description

Get an Ad Tag report that includes impressions count, CVR, eCPM, etc.

Parameters
Name Data Type Description Required
start_date Date The start date of the range. Format is YYYY-MM-DD Yes
end_date Date The end date of the range. Format is YYYY-MM-DD Yes
fields Array An array with the fields wanted as the keys and "on" as value. Possible fields are impressions, cpm, click_unique, ctr, installs, cr, payout Yes at least one
filters Array An array of parameters where the Key should be the name of the field to filter by and the value the ID of the field. Possible keys of the array are offer_id and creative_id. No
limit Integer The number of items returned per page. No
page Integer Page by the limit of times returned. Defaults is the first page. No
sort String Sort by one of the fields requested but it has to be requested. No
sortby String If sort is used, ascending or descending can be choosen here by sending ASC or DESC in the sortby parameter. No
format String A string with the format of the response. At this moment, all results will be in json so this parameter can be ignored. No
Response

An array of Stats objects containing the stats report requested.

Example Code (PHP)
Get payout, installs, clicks, impressions and other metrics from all campaigns from the last 3 days and return the result in json format.
< ? php

    $baseURL = 'http://api.hangmytracking.com/api.php';

    $parameters = array(
        'method' => 'getPrintsReport'
        ,'apiToken' => API_KEY
        ,'apiID' => NETWORK_ID
        ,'format' => 'json'
        ,'sort' => 'payout'
        ,'sortby' => 'desc'
        ,'fields[impressions]' => 'on'
        ,'fields[click_unique]' => 'on'
        ,'fields[ctr]' => 'on'
        ,'fields[installs]' => 'on'
        ,'fields[cr]' => 'on'
        ,'fields[payout]' => 'on'
        ,'start_date' => date('Y-m-d', strtotime('-2 days'))
        ,'end_date' => date('Y-m-d')
    );

    $postData = http_build_query($parameters);
    
    $ch = curl_init();  
    curl_setopt($ch,CURLOPT_URL,$baseURL);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch,CURLOPT_HEADER, false); 
    curl_setopt($ch, CURLOPT_POST, count($postData));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);    
    $output=curl_exec($ch);
    curl_close($ch);

    $response = json_decode($output);
?>
Method

getTrackingLink

Description

Get the Tracking Link from available offers. If the offer requires approval, a access request has to be made first.

Parameters
Name Data Type Description Required
offerID Integer The ID of the Offer for which the tracking link is requested. Yes
urlID Integer To redirect to a diferent landing page send the ID of the URL in the offer. If a 50/50 random test is wanted, send random in this parameter. No
adID Integer To track a specific ad send the ID of the ad in the offer. No
Response

The affiliate tracking link for the offer.

Example Code (PHP)
Get the tracking link from offer ID 23 and make a random A/B test with the URLs in the offer.
< ? php

    $baseURL = 'http://api.hangmytracking.com/api.php';

    $parameters = array(
            'method' => 'getTrackingLink'
            ,'apiToken' => API_KEY
            ,'apiID' => NETWORK_ID
            ,'offerID' => 23
            ,'urlID' => 'random'
    );

    $postData = http_build_query($parameters);
    
    $ch = curl_init();  
    curl_setopt($ch,CURLOPT_URL,$baseURL);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch,CURLOPT_HEADER, false); 
    curl_setopt($ch, CURLOPT_POST, count($postData));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);    
    $output=curl_exec($ch);
    curl_close($ch);

    $response = json_decode($output);
?>
Method

requestOfferAccess

Description

Request access to an offer.

Parameters
Name Data Type Description Required
offerID Integer The ID of the offer for which access is being requested. Yes
Response

Hang My Tracking response to the offer access request.

Example Code (PHP)
Request access to offer ID 79.
< ? php

    $baseURL = 'http://api.hangmytracking.com/api.php';

    $parameters = array(
            'method' => 'requestOfferAccess'
            ,'apiToken' => API_KEY
            ,'apiID' => NETWORK_ID
            ,'offerID' => 79
    );

    $postData = http_build_query($parameters);
    
    $ch = curl_init();  
    curl_setopt($ch,CURLOPT_URL,$baseURL);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch,CURLOPT_HEADER, false); 
    curl_setopt($ch, CURLOPT_POST, count($postData));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);    
    $output=curl_exec($ch);
    curl_close($ch);

    $response = json_decode($output);
?>
Copyright © Hang My Tracking. All rights reserved.