This library provides an API to track events and update profiles on Mintance.
Add mintance/mintance-php as a dependency and run composer update
$ composer require mintance/mintance-php
Or:
{
"require": {
"mintance/mintance-php" : "1.*"
}
}
Now you can start tracking events and people:
<?php
// Import dependencies
require 'vendor/autoload.php';
// Create Mintance class, replace with your project token
$mt = new Mintance("PROJECT_TOKEN");
// Identify your contact.
$mt->people->setIdentifier("my_people_id");
// Track an event
$mt->track("button clicked", array("label" => "sign-up"));
// Create/Update a profile for user id 12345
$mt->people->set(array(
'first_name' => "John",
'last_name' => "Doe",
'email' => "[email protected]",
'phone' => "5555555555",
// Custom fields
'Favorite Color' => "red"
));
- Download the Mintance PHP Library
- Extract the zip file to a directory called "mintance-php" in your project root
- Now you can start tracking events and people:
<?php
// Import Mintance
require 'mintance-php/src/Mintance.php';
// Create Mintance class, replace with your project token
$mt = new Mintance("PROJECT_TOKEN");
// Track an event
$mt->track("button clicked", array("label" => "sign-up"));
// Create/Update a profile for user id 12345
$mt->people->set(array(
'first_name' => "John",
'last_name' => "Doe",
'email' => "[email protected]",
'phone' => "5555555555",
// Custom fields
'Favorite Color' => "red"
));