Giter VIP home page Giter VIP logo

php-sdk's Introduction

Infinario PHP SDK

The \Infinario\Infinario class provides access to the Infinario PHP tracking API. The SDK requires PHP >= 5.3.2 and php5-curl.

Installation

Install the latest version with Composer:

composer require infinario/infinario

Getting started

In order to track events, instantiate the class at least with your project token (can be found in Project Management in your Infinario account), for example:

use Infinario\Infinario;

$infinario = new Infinario('12345678-90ab-cdef-1234-567890abcdef');                       // PRODUCTION ENVIRONMENT
// $infinario = new Infinario('12345678-90ab-cdef-1234-567890abcdef', ['debug' => true]); // DEVELOPMENT ENVIRONMENT

You can also provide a PSR-3 compliant logger interface:

$infinario = new Infinario('12345678-90ab-cdef-1234-567890abcdef', ['logger' => $logger]);

Timeout for sending data is set to 1000ms you can overwrite it by following option:

$infinario = new Infinario('12345678-90ab-cdef-1234-567890abcdef', ['timeout' => 500]);

Identifying the customer

When tracking events, you have to specify which customer generated them. This can be either done right when calling the client's constructor.

use Infinario\Infinario;

$infinario = new Infinario('12345678-90ab-cdef-1234-567890abcdef', ['customer' => 'john123']);

or by calling identify.

$infinario->identify('john123');

Tracking events

To track events for the currently selected customer, simply call the track method.

$infinario->track('purchase');

You can also specify an array of event properties to store with the event.

$infinario->track('purchase', ['product' => 'bottle', 'amount' => 5]);

Updating customer properties

You can also update information that is stored with a customer.

$infinario->update(['first_name' => 'John', 'last_name' => 'Smith']);

php-sdk's People

Contributors

ms7s avatar martinstrycek avatar

Stargazers

Katia Esposito avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.