PHP code example of gosquared / php-sdk

1. Go to this page and download the library: Download gosquared/php-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/ */

    

gosquared / php-sdk example snippets




$opts = array(
  'site_token' => 'your-site-token',
  'api_key' => 'your-api-key'
);
$GS = new GoSquared($opts);

// Track events
$result = $GS->track_event('Event Name');

// Create anonymous Person
$person = $GS->create_person();

// Identify person
$response = $person->identify(array(
  'id' => 'user-id',
  'name' => 'Foo Bar',
  'email' => '[email protected]'
));

// Retrieve live data
$result = $GS->now->concurrents();

// Retrieve historical trends and ecommerce data
$result = $GS->trends->aggregate();


define('GOSQUARED_DEBUG', true);