Get a token to track your web content using our API
You can automate and customize this process by integrating our API into your programs.
Our API protocol uses the REST format.
The REST Endpoint URL is: GET http://tokentracker.com/get-token.php
Maximum of 100 request per day (10,000 for our TokenTracker Professional service).
Parameters
api_key (your TokenTracker API Key)
guid (url, optional, the url for the token you wish to track)
title (string, optional, the tokens title)
description (string, optional, max 255 characters, the token description)
publisher (string, optional, the publishers name)
publisher_email (md5, optional, the publishers email, is required if publisher parameter is used)
custom_field (array, optional, your own field name and value, eg: tag[]=Melbourne or name[]=Jane or id[]=555, etc)
^ You require either a guid or a title or both.
Example request
GET http://tokentracker.com/get-token.php?api_key=df9b5b51e81d63ef3f20f584dccef9c1&guid=http%3A%2F%2Fmysite.com%2Furl-to-track%2F&title=Lorem+Ipsum&description=Lorem+ipsum+dolor+sit+amet+consectetuer+adipiscing+elit.&publisher=Jane+Doe&
publisher_email=35f5782642e9fa0f6cfff5a552e2ae97&tag[]=Melbourne&tag[]=park&name=[]Jane
Successful response example
The token_url is a 1x1 pixel sized transparent image which you can insert into the web content you wish to track.
<?xml version='1.0' encoding='UTF-8'?> <tt_api_server_rsp status='ok' version='0.3'> <token_id>49V347zae</token_id> <token_url>http://tokentracker.com/token.gif?id=49V347zae</token_url> </tt_api_server_rsp>
Failed response example
<?xml version="1.0" encoding="UTF-8"?> <?robots index="no" follow="no"?> <tt_api_server_rsp status="fail" version="0.3"> <err code="177" msg="You do not have a TokenTracker account." /> </tt_api_server_rsp>
PHP example of token generator using the TokenTracker class
<?php
/*
* TokenTracker get token example.
*/
// Using the free TokenTracker class.
require_once("TokenTracker.class.php");
$tokentracker = new TokenTracker;
$tokentracker->api_key = 'df9b5b51e81d63ef3f20f584dccef9c1'; // Your TokenTracker API Key
// These are optional parameters:
$tokentracker->guid = 'http://mysite.com/url-to-track/';
$tokentracker->title = 'Lorem Ipsum';
$tokentracker->description = 'Lorem ipsum dolor sit amet consectetuer adipiscing elit.';
$tokentracker->publisher = 'Jane Doe';
$tokentracker->publisher_email = 'jane@doe.com';
$fields['tag'][0] = 'Melbourne';
$fields['tag'][1] = 'park';
$fields['name'][0] = 'Jane';
$tokentracker->fields = $fields;
if ( $tokentracker->request_token() ) {
// Successfully got token ID.
echo "token_id: " . $tokentracker->token_id . "\n";
echo "token_url: " . $tokentracker->token_url . "\n";
// Can insert this xhtml img code into your web content.
echo $tokentracker->token_img_code;
} else {
// Failed.
echo "error_code: " . $tokentracker->error_code . "\n";
echo "error_message: " . $tokentracker->error_message . "\n";
}
?>
View the TokenTracker.class.php PHP class - Download example PHP script with class files