This library helps integrating Bento into PHP applications.
This library can be installed via Composer:
composer require arvesolland/bento-php-sdk dev-master
Before tracking user or event data, create a new client. If you configured your site uuid via environment variables (BENTO_SITE_UUID) there's nothing to add. Otherwise, see the example above.
// Via .env variables
$bento = new \Bento();
or directly inject the site uuid
$bento = new \Bento('YOURSITEUUIDHERE');
// if you have their email address, identify the user.
// do this before anything else.
$bento->identify('user@example.org');
$bento->tag('tag_1,tag_2');
$bento->track('some_event',['some_key'=>'Some Value']);
// you can add custom fields to your visitors which you can leverage for personalization.
$bento->updateFields(['first_name'=>'ash','last_name'=>'ketchum]);
$bento = new \Bento();
$bento->identify('user@example.org');
$bento->updateFields(['first_name'=>'ash','last_name'=>'ketchum]);