Server-side tracking for PHP, Laravel and custom ecommerce
Most custom stores in Bangladesh run on PHP. Add one class, call purchase when the order is created, and every ad platform gets it once, with the ad click that brought the shopper.
Illustration of the event flow
What you get
Plain PHP
PHP 7.4 or newer with the curl extension. Works in Laravel jobs, Symfony services, CodeIgniter or hand-written shops.
Browser context
BrowserContext::shopperFromGlobals() captures IP, user agent and the SDK's cookies at checkout; store it on the order for later jobs.
COD lifecycle
purchase, refund (per refund id) and cancel map directly to your order statuses.
Clear errors
Rejected requests throw TrakeroException with the HTTP status and a code such as invalid_key.
Where browser-only tracking loses the sale
Pick a situation your shoppers are in and watch one order take both paths.
A shopper from your Facebook ad places an order.
Illustration of what happens on shoppers' devices, not a measurement.
Set up in minutes
- 1Add the browser snippet to your theme.
- 2Copy the SDK (composer package trakero/trakero-php) and set your secret key.
- 3Call $trakero->purchase(...) when the order is placed or confirmed.
Questions
How do I install it?+
The Composer package is trakero/trakero-php. Until it is on Packagist, add it from the Trakero repository (sdk/php).
Can I send from a queue?+
Yes. Capture the shopper array at checkout, save it with the order, and pass it when your queued job sends the purchase.