PHP code example of thomas-dotworx / gosquared-php-sdk

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

    

thomas-dotworx / 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('user-id', array(
  'name' => 'Foo Bar',
  'email' => '[email protected]'
));

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

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

// Retrieve Ecommerce data
$result = $GS->ecommerce->transactions();

define('GOSQUARED_DEBUG', true);