How to send events through the API

You can send events to our system from server side.

To implement this and identify the user doing the event there are 2 options:

  1. pass the email address
  2. pass userId and sessionId found on the client-side.

 

We don’t currently support other type of user identification. Note that sending user email address does not subscribe users and it’s only required to manage user activity sessions.

Request type: GET

BASE URL: https://app.vtcdn.net/event/<account_id>/

Params: 

  • data -> json encoded list of events (see below)
  • callback -> any custom string (optional)
  • ts -> random integer

 

Example code below, please change the values in red.

<?php
$server_base = "https://app.vtcdn.net/event/<account_id>/";
// list of items in the order
$items = array(array("id" => "123123-M", "quantity" => 2), array("id" => "23423-XL", "quantity" => 1));
// confirmatino object
$confirmation = array("userId"=>"0111", "sessionId" => "013123", "type" => 'confirmation', "items" => $items, "generic" => array("orderId"=>"order_id_example", "total" => 234.12, "email" => "[email protected]"));
$params = array (
"data" => json_encode(array($confirmation)),
"callback" => 'vt',
"ts" => rand(0,1000)
);

$server_base = $server_base . '?' . http_build_query($params);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $server_base);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);

?>

 

Related Articles