Search by

vidovo / pixel-php

ChanningDefoe

Send conversions, refunds and cancellations from your server to the Vidovo pixel.

Package info

github.com/vidovo/pixel-php

pkg:composer/vidovo/pixel-php

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.2.0 2026-11-30 21:06 UTC

This package is auto-updated.

Last update: 2026-11-30 21:10:36 UTC


README

Vidovo pixel for PHP

Packagist PHP CI License

Send conversions, refunds and cancellations from your server to the Vidovo pixel. A sale your server sends is confirmed, and it still counts when the buyer's browser blocks the pixel or closes too soon.

Install

composer require vidovo/pixel-php

PHP 8.2 or newer, with the curl extension. No dependencies.

Usage

use Vidovo\Pixel\Pixel;

$pixel = new Pixel(getenv('VIDOVO_PIXEL_SECRET_KEY'));

$pixel->conversion([
    'event_name' => 'purchase',
    'order_id' => '5001',
    'value' => 80.00,
    'currency' => 'USD',
    'vidovo' => $order->vidovo, // who the buyer was, saved at checkout
]);

Refunds and cancellations

refunded_total is everything refunded on the order so far.

$pixel->refund(['order_id' => '5001', 'refunded_total' => 30.00, 'currency' => 'USD']);

$pixel->cancellation(['order_id' => '5002']);

send takes several events and sends them in one request. Vidovo takes all of them or none.

$pixel->send([
    ['type' => 'conversion', 'event_name' => 'sign_up', 'event_id' => 'signup-7', 'customer_id' => '7', 'vidovo' => $vidovo],
    ['type' => 'cancellation', 'order_id' => '5002'],
]);

The buyer

A sale is credited to the Vidovo link that brought its buyer. The pixel keeps the buyer in cookies on your site, so read them off a request the buyer's browser makes, like your checkout, and save the result with the order:

$order->vidovo = Pixel::vidovoFromCookies($_COOKIE);

It is null when the buyer is not tracked. A payment webhook or a background job has no cookies, so read it while the buyer is there.

If you get the pixel's cookie some other way, pass the _vdv_visitor value in vidovo as it is, and the SDK turns it into what Vidovo reads:

$pixel->conversion(['event_name' => 'purchase', 'order_id' => '5001', 'vidovo' => $order->vdv_visitor_cookie]);

vidovo also takes the text vidovo('checkout') gives your page.

Laravel encrypts cookies and empties the ones it did not write. Pass $_COOKIE, or add _vdv_visitor, _vdv_kept and _vdv_off to the cookies it leaves alone and pass $request->cookies->all().

Errors

An answer other than success throws a PixelException, with the message Vidovo sent. When no answer came, status is 0.

use Vidovo\Pixel\PixelException;

try {
    $pixel->conversion($conversion);
} catch (PixelException $e) {
    if ($e->retryAfter) {
        // 429 or 503: send the same request again after $e->retryAfter seconds
    }
}

Options

$pixel = new Pixel($secretKey, baseUrl: 'https://px.vidovo.com', timeout: 10);

License

MIT