Layer 1 copy
Tutorials Fraud Detection - Send Historical Data

Fraud Detection - Send Historical Data

Sending historical data is a free and fast way to improve the accuracy of your fraud predictions.

Steps:

  1. Send 6-12 months of key events for all users (good and bad). Most customers send, when relevant, $create_order,$transaction ,$create_account, and $create_content.
  2. Include $time : the UNIX timestamp at which the event occured (in milliseconds as an integer).
  3. Include $ip : the IP of the user at the time of the event (if available).
  4. Label fraudulent users as Bad via the Labels API.

Important Notes:

  1. Backfill your production account after testing in the sandbox.
  2. Label all the known fraudulent users as Bad. Don't use the Not Bad label for the historical backfill.
  3. Be aware of rate limits and build in a retry.
  4. While we use up to 12 months of historical data, users with activity older than 30 days will not show up in the console.
  5. The purpose of sending historical data is to improve the accuracy of your live predictions. To this end, we process historical data differently than live data. If you want to do analysis of Sift Scores, you can do this against live data.
// Sample $create_account event
{
  // Required for backfilling
  // UNIX timestamp in milliseconds as an iteger
  "$time" : 1456274104243, // Feb 24 2016 00:35:04 UTC

  "$type"             : "$create_account",
  "$api_key"          : "your_api_key_here",
  "$user_id"          : "billy_jones_301",
  "$user_email"       : "bill@gmail.com",
  "$name"             : "Bill Jones",
  "$phone"            : "1-415-555-6040",
  "$ip"               : "54.208.214.78"
}
import sift

client = sift.Client("your_api_key_here")

# Sample $create_account event
properties = {
  # Required for backfilling
  # UNIX timestamp in milliseconds as an iteger
  "$time" : 1456274104243, # Feb 24 2016 00:35:04 UTC

  "$user_id"          : "billy_jones_301",
  "$user_email"       : "bill@gmail.com",
  "$name"             : "Bill Jones",
  "$phone"            : "1-415-555-6040",
  "$ip"               : "54.208.214.78"
}

response = client.track("$create_account", properties)
require "sift"

client = Sift::Client.new(:api_key => "your_api_key_here")

# Sample $create_account event
properties = {
  # Required for backfilling
  # UNIX timestamp in milliseconds as an iteger
  "$time" => 1456274104243, # Feb 24 2016 00:35:04 UTC

  "$user_id"          => "billy_jones_301",
  "$user_email"       => "bill@gmail.com",
  "$name"             => "Bill Jones",
  "$phone"            => "1-415-555-6040",
  "$ip"               => "54.208.214.78"
}

response = client.track("$create_account", properties)
require 'sift-php/lib/Services_JSON-1.0.3/JSON.php';
require 'sift-php/lib/SiftRequest.php';
require 'sift-php/lib/SiftResponse.php';
require 'sift-php/lib/SiftClient.php';
require 'sift-php/lib/Sift.php';

$client = new SiftClient(array('api_key' => 'your_api_key_here'));

// Sample $create_account event
$properties = array(
  // Required for backfilling
  // UNIX timestamp in milliseconds as an iteger
  '$time' => 1456274104243, // Feb 24 2016 00:35:04 UTC

  '$user_id'          => 'billy_jones_301',
  '$user_email'       => 'bill@gmail.com',
  '$name'             => 'Bill Jones',
  '$phone'            => '1-415-555-6040',  
  '$ip'               => '54.208.214.78'
);

$response = $client->track('$create_account', $properties);

What is Unix Time?

Unix time is the amount of time passed since 00:00:00 UTC, Thursday, 1 January 1970. There are many Unix timestamp converters available online. See sample code to the right.

echo $(($(gdate +'%s * 1000 + %-N / 1000000')))
import time
time_millis = int(round(time.time() * 1000))
time_millis = (Time.now.to_f * 1000).round
$timeMillis = round(microtime(true) * 1000);