REST API

REST API

The TrueStats user profiling and scoring API provides the ability to get real-time intel on your users from any platform you are using. It uses a standard REST interface that returns a JSON object with the profile data. It can be integrated into any major platform.

This information provided by the API includes:

DataUse
Fraud ScoreKnow whether the user is real or a bot. Here is our detection methodology.
Device DataInstantly know what kind of device type the user in on (desktop/mobile/tablet, etc.). Over 22,000 specific devices are detected.
Geolocation and DemographicsKnow median household income, home values, and age and gender breakdowns on the location of the user.
OrganizationSee what organization a user is originating from, whether it's an ISP, corporation, university or government agency.
TechnologyGet detailed browser and platform (with versions) data on your users.
Search info Over 200 search engines are detected. See if your user was referred by a search engine and with what keywords (if they are provided).

Integrate in Minutes

For help on how to implement the API, see our profile and scoring documentation.

The API is easily integrated into your systems. To the right are some examples. More extensive examples are at our profile and scoring documentation.help section.

Developers, try it out with our API tester:

To use the production version, signup for an account and get an access token with query rights.

After signing up, for help on how to get an access token, see our access token documentation.

var gator = require('gator-score');"

var options = {
    ip: '72.211.250.156',
    ua: 'Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko)'
};

gator.score(options, function (err, result) {
    if (result && result.score < 100) {
        console.log('Invalid user'); 
    }
}); 
curl -X GET --header 'Accept: application/json' 'https://api.truestats.com/v1/score?ip=72.211.250.156&ua=Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20WOW64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F42.0.2311.135%20Safari%2F537.36'
GET /v1/score?ip=72.211.250.156&ua=Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20WOW64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F42.0.2311.135%20Safari%2F537.36 HTTP/1.1
Host: api.truestats.com
User-Agent: Phantom JS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Net;
using System.IO;

namespace ConsoleApplication1
{
    public class Class1
    {

        //  The user scoring/profiling endpoint.
        public const string API_URL = "https://api.truestats.com/v1/score";

        static void Main(string[] args)
        {
            Class1.CreateObject();
        }

        private static void CreateObject()
        {
            //  To use the API in production, create an account and get an access token from the website.  
            //  Then assign it to the accessToken variable below.  Calls without an access
            //  token will be rate limited.
            string accessToken = "";  //  change this to an access token for production use

            //  set up the parameters for the API call
            string ip = "72.203.234.33";    //  The I.P. address of the user

            //  the user agent of the user, if known
            string ua = "Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405";

            //  the url of the request to your platform
            string url = "http://www.mysite.com?utm_campaign=BingAds";

            //  the referrer of the request to your platform - this could be in the HTTP_REFERER header of the request
            string referrer = "http://bing.com/search?q=car";

            //  encode the request parameters
            string query = API_URL
                + "?accessToken=" + accessToken
                + "&ip=" + ip
                + "&ua=" + HttpUtility.UrlEncode(ua)
                + "&url=" + HttpUtility.UrlEncode(url)
                + "&referrer=" + HttpUtility.UrlEncode(referrer);

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(query);
            request.Method = "GET";

            try
            {
                WebResponse webResponse = request.GetResponse();
                using (Stream webStream = webResponse.GetResponseStream())
                {
                    if (webStream != null)
                    {
                        using (StreamReader responseReader = new StreamReader(webStream))
                        {
                            string response = responseReader.ReadToEnd();
                            Console.Out.WriteLine(response);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.Out.WriteLine(e.Message);
            }
        }
    }
}

Analytics

Get full analytics on your users. The API aggregates data on quality scores, geolocation, demographics, search, device types, devices, campaigns, publishers and much more. Full reporting is available on your users:

Sample Use Cases

UseReason
AdsDo not display ads to invalid users. Keep your reputation as a publisher intact.
Content OptimizationTailor your content based on a user's geo, demo or device type.
Offers Base offers on location, search terms, or user's demographic.
Publisher NetworksSee which publishers have the best and worst traffic.
Save bandwidthWhy stream videos to bots?

High Volume

The API supports high-volume usage.

Colocation

We support the colocation of our API in order to provide the fastest possible lookups. Contact us for more information.

Pricing

TrueStats is a pay-as-you-go service based on the total number of hits in a month.

500K Hits
$100 Month

Up to 500,000 hits

500K Hits
$200 Month

Up to 1,000,000 hits

500K Hits
$300 Month

Up to 2,000,000 hits

500K Hits
$400 Month

Up to 3,000,000 hits

Hits are the total sessions, events, page views and API calls.

We offer our first price break at 1 million hits for $200 per month. Every additional million hits after that only costs $100 per month. If your website is recording over 5 million or 40 million hits, we recommend contacting us about high volume and enterprise pricing respectively.

How do I choose a plan?

TrueStats is only available as a pay-as-you-go service. The monthly service charge is based solely on the amount of traffic that TrueStats records and analyses. That traffic is measured in hits: the total sessions, page views and API calls the TrueStats servers receive from your website in a single month.

Is there a discount for a bulk purchase?

TrueStats offers bonus hits when you purchase quarterly or annually. Credit is applied to your account and you are given an extra 10% of hits a month to use. We recommend this discount for high volume and enterprise customers, but it is available to all customers. Contact our sales team or call 888-453-5291 to learn more.