Segment simplifies the process of collecting data and connecting new tools, allowing you to spend more time using your data, and less time trying to collect it. You can use Segment to track events that happen when a user interacts with the interfaces. “Interfaces” is Segment’s generic word for any digital properties you own: your website, mobile apps, and processes that run on a server or OTT device.
You can install the package via composer:
composer require binarcode/laravel-segment
You can publish and run the migrations with:
php artisan vendor:publish --tag="segment-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="segment-config"
This is the contents of the published config file:
return [
/**
* The queue name where the segment events will be dispatched.
*/
'queue' => env('SEGMENT_QUEUE', env('QUEUE_CONNECTION', 'sync')),
/**
* Segment API key [see: https://segment.com/docs/connections/sources/catalog/libraries/server/php/#identify].
*/
'key' => env('SEGMENT_KEY', ''),
];
BinarCode\LaravelSegment\Facades\LaravelSegment::track('click')->properties([...])
BinarCode\LaravelSegment\Facades\LaravelSegment::alias($previous, $userId);
BinarCode\LaravelSegment\Facades\LaravelSegment::identify($userId, $data);
The Segment Identify call lets you tie a user to their actions and record traits about them. It includes a unique User ID and any optional traits you know about the user, like their email, name, and more.
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.