[go: up one dir, main page]

Skip to content

cossou/trak-io-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trak.io Api Client

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

Installation

Install via Composer:

{
    "require": {
        "cossou/trak-io-api-client": "1.0.*"
    }
}

Methods available

  • identify
  • alias
  • track
  • annotate
  • distinct_id
  • channel

Documentation: http://docs.trak.io/

Examples

Quick Identify example:

require_once 'vendor/autoload.php';

use Cossou\Trakio;

$trakio = Trakio::init('YOUR-API-TOKEN');

// or
// $trakio = Trakio::init('YOUR-API-TOKEN', array('distinct_id' => 123));

try {
    $response = $trakio->identify(array('distinct_id' => 123, 'properties' => array('name' => 'Hélder Duarte')));
    var_dump($response);
} catch(Exception $e) {
    echo $e->getMessage();
}

Laravel

Add to your app/config/app.php file and scroll down to your providers and add

'providers' => array(
    ...
    'Cossou\TrakioServiceProvider',
)

And the alias:

'aliases' => array(
	...
   	'Trakio'		  => 'Cossou\Facades\Trakio',

And finally you run php artisan config:publish cossou/trak-io-api-client and fill in your API key.

And that's it!

Quick Laravel Example

Route::get('/', function()
{
	$trak = new Trakio;

	try {
		$response = $trak::identify(array('distinct_id' => 123, 'properties' => array('name' => 'Hélder Duarte')));
		dd($response);
	} catch(Exception $e) {
		dd($e->getMessage());
	}	
}

License

MIT License