PHP code example of vantevo-analytics / sdk

1. Go to this page and download the library: Download vantevo-analytics/sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vantevo-analytics / sdk example snippets




$client = new Vantevo\Client('accessToken', 'domain', 'timeout' 'dev');

try {
    $data = array("event" => "pageview", "title" => "Eaxmple Page view");
	$client->event($data);
} catch (Exception $e) {
	// something went wrong...
}

try {
    $data = array("event" => "Download", "meta" => array("pdf": "Recipes"));
	$client->event($data);
} catch (Exception $e) {
	// something went wrong...
}

try {
    $data = array(
		"event" => "view_item",
		"items" => array(
			array(
				"item_id" => "SKU_123",
				"item_name" => "Samsung Galaxy",
				"currency" => "EUR",
				"quantity" => 0,
				"price" => 199.99,
				"discount" => 0,
				"position" => 1,
				"brand" => "Samsung",
				"category_1" => "Smartphone",
				"category_2" => "Samsung",
				"category_3" => "Galaxy",
				"category_4" => "",
				"category_5" => "",
				"variant_1" => "Black",
				"variant_2" => "5.5 inch",
				"variant_3" => ""
			)
		)
		);
	$client->trackEcommerce($data);
} catch (Exception $e) {
	// something went wrong...
}

try {
    $data = array("source" => "pages", "period" => "1m");
	$stats = $client->stats($data);
} catch (Exception $e) {
	// something went wrong...
}

try {
    $data = array("source" => "events", "period" => "1m");
	$events = $client->events($data);
} catch (Exception $e) {
	// something went wrong...
}