Server-side SDKs

Scoby Analytics PHP SDK

Welcome to the PHP Client documentation for Scoby Analytics. This guide will help you set up and utilize our PHP SDK to gain insightful data about your web application's user interactions.


You need your License Key and Salt to use our PHP SDK.


To get started, install the package using composer:

composer require scoby/analytics



First, instantiate the Scoby Analytics client with your License Key and salt:

use Scoby\Analytics\Client;

Logging Methods

The client supports both synchronous and asynchronous logging:

  • Synchronous logging:
  • Asynchronous logging:

Note: PHP scripts are inherently blocking. The logPageViewAsync method executes after all main tasks are completed, just before your script terminates.

Setting Data Manually

The client can automatically scan the $_SERVER variable, but you have control over setting specific data:

  • IP Address:
  • User-Agent:
$client->setUserAgent('Mozilla/5.0 ... Firefox/103.0');
  • Requested URL:
  • Referring URL:

Segmenting Visitors

Visitor segmentation enhances your understanding of your audience. Segment your audience by various criteria, then log their interactions:

    ->addVisitorToSegment('Young Adults')

Note: Scoby Analytics applies k-Anonymity of 25 for visitor segments to ensure privacy.

Setting your own Visitor ID

Improve visitor counting accuracy with a custom identifier:


IP Blacklisting

Exclude specific IPs or ranges from your measurements:



Need help? Reach out at