arvesolland / bento-php-sdk

PHP SDK for Bento

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bento PHP SDK

This library helps integrating Bento into PHP applications.

Installation

This library can be installed via Composer:

composer require arvesolland/bento-php-sdk dev-master

Usage

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');

Tracking Users

Identify your user

// if you have their email address, identify the user.
// do this before anything else.
$bento->identify('user@example.org');

Tag a visitor

$bento->tag('tag_1,tag_2');

Log a custom event

$bento->track('some_event',['some_key'=>'Some Value']);

Update custom fields

// you can add custom fields to your visitors which you can leverage for personalization.
$bento->updateFields(['first_name'=>'ash','last_name'=>'ketchum]);

Full Example

$bento = new \Bento();
$bento->identify('user@example.org');
$bento->updateFields(['first_name'=>'ash','last_name'=>'ketchum]);

About

PHP SDK for Bento


Languages

Language:PHP 100.0%