The PHP SDK makes it easy to track events from PHP applications.
Installation
The PHP SDK can be installed via Composer:
To initialize the PHP SDK in your application:
API
Identify
The identify method sends an identify event.
Unlike the Browser SDK, it does not persist the user ID and
traits locally, so user IDs must be explicitly added to other events. This is
because server side events are usually servicing many different users at once.
Example usage:
Method parameters:
Track
The track method sends a track event.
Example usage:
Method parameters:
Page
The page method sends a page event.
Example usage:
Method parameters:
Screen
The screen method sends a screen event.
Example usage:
Method parameters:
Group
The group method sends a group event.
Example usage:
Method parameters:
Flush
The PHP SDK buffers events locally before sending them to Hightouch’s servers.
This minimizes the number of requests made by the SDK and improves performance.
To force the local buffer to be sent to Hightouch immediately call the flush
method. flush should be called when shutting down your app to make sure no events are lost.
Example usage:
Last modified on March 25, 2024