PHP code example of diagvn / mixpanel

1. Go to this page and download the library: Download diagvn/mixpanel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

diagvn / mixpanel example snippets



// import dependencies
use MixPanel\Services\MixPanelService;
// get the MixPanelService class instance, replace with your project token
$mp = new MixPanelService();
$mp->setToken("MIXPANEL_PROJECT_TOKEN");

// track an event
$mp->track("button clicked", array("label" => "sign-up"));

// create/update a profile for user id 12345
$mp->people->set(12345, array(
    '$first_name'       => "John",
    '$last_name'        => "Doe",
    '$email'            => "[email protected]",
    '$phone'            => "5555555555",
    "Favorite Color"    => "red"
));


// import dependencies
use MixPanel\Services\MixPanelService;
// get the MixPanelService class instance, replace with your project token
$mp = new MixPanelService();
$mp->setToken("MIXPANEL_PROJECT_TOKEN");

// track an event
$mp->track("button clicked", array("label" => "sign-up"));

// create/update a profile for user id 12345
$mp->people->set(12345, array(
    '$first_name'       => "John",
    '$last_name'        => "Doe",
    '$email'            => "[email protected]",
    '$phone'            => "5555555555",
    "Favorite Color"    => "red"
));