You can send events to our system from server side.
To implement this and identify the user doing the event there are 2 options:
- pass the email address
- 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.
Event type is the same as type within the data. First example is confirmation.
<?php $server_base = "https://app.vtcdn.net/event/<account_id>/<event_type>"; // list of items in the order $items = array(array("id" => "123123-M", "quantity" => 2), array("id" => "23423-XL", "quantity" => 1)); // confirmation 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); ?>
Example 2 login event. Here event_type is login
<?php $server_base = "https://app.vtcdn.net/event/<account_id>/<event_type>"; $event = array("type" => 'login', "email" => "[email protected]", "source" => "source_type"); $params = array ( "data" => json_encode(array($event)), "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); ?>