Secure your business from login to chargeback
Stop fraud, break down data silos, and lower friction with Sift.
- Achieve up to 285% ROI
- Increase user acceptance rates up to 99%
- Drop time spent on manual review up to 80%
The goal of sending custom events and fields is to
For example, let's say you have a voice over IP phone business, and you want to record when a user makes a
call. You can create a custom event called make_call
as shown.
Three fields are required in custom events:
$type
, $api_key
, and the $user_id
or $session_id
which identifies the user
taking the action.
// A hypothetical custom event recording a call made // using a number of formatted fields { "$type" : "make_call", "$api_key" : "YOUR_API_KEY", "$user_id" : "billy_jones_301", "recipient_user_id" : "marylee819", "call_duration" : 4428 }
import sift client = sift.Client(api_key='{apiKey}', account_id='{accountId}') # A hypothetical custom event recording a call made # using a number of formatted fields properties = { "$user_id" : "billy_jones_301", "recipient_user_id" : "marylee819", "call_duration" : 4428 } response = client.track("make_call", properties)
require "sift" client = Sift::Client.new(:api_key => "YOUR_API_KEY") # A hypothetical custom event recording a call made # using a number of formatted fields properties = { "$user_id" => "billy_jones_301", "recipient_user_id" => "marylee819", "call_duration" => 4428 } response = client.track("make_call", 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')); // Sample $link_session_to_user event $properties = array( '$user_id' => 'billy_jones_301', 'recipient_user_id' => 'marylee819', 'call_duration' => 4428 ); $response = $client->track('make_call', $properties);
import com.siftscience.SiftClient; import com.siftscience.EventRequest; import com.siftscience.model.CustomEventFieldSet; SiftClient client = new SiftClient("YOUR_API_KEY"); EventRequest request = client.buildRequest(new CustomEventFieldSet() .setUserId("billy_jones_301") .setEventType("make_call") .setCustomField("recipient_user_id", "marylee819") .setCustomField("call_duration", 4428) ); EventResponse response; try { response = request.send(); } catch (SiftException e) { System.out.println(e.getApiErrorMessage()); return; } response.isOk(); // true
In general, events sent to our Events API should
describe a particular action taken by a user. We encourage starting the name of your custom events
with a verb in present tense, e.g. add_new_connection
or create_new_location
.
Custom event names may only include alphanumeric characters
and _
.
We encouage you to adopt our naming conventions in creating custom event and custom field names. We use lower case and snake_case for all event and field names.
Send fields using our reserved suffixes when possible to take advantage of additional analysis.
Stop fraud, break down data silos, and lower friction with Sift.