mintance / mintance-php
Mintance官方PHP库
1.0.5
2017-09-05 13:01 UTC
Requires
- php: >=5.0
Requires (Dev)
- phpdocumentor/phpdocumentor: 2.*
- phpunit/phpunit: 4.7.*
This package is not auto-updated.
Last update: 2024-09-26 06:35:28 UTC
README
此库提供了一个API,用于在Mintance上跟踪事件和更新个人资料。
使用Composer安装
将mintance/mintance-php作为依赖项添加,并运行composer update
$ composer require mintance/mintance-php
或者
{ "require": { "mintance/mintance-php" : "1.*" } }
现在您可以从跟踪事件和人物开始
<?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' => "john.doe@example.com", 'phone' => "5555555555", // Custom fields 'Favorite Color' => "red" ));
手动安装
- 下载Mintance PHP库
- 将zip文件解压到项目根目录下的名为"mintance-php"的目录中
- 现在您可以从跟踪事件和人物开始
<?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' => "john.doe@example.com", 'phone' => "5555555555", // Custom fields 'Favorite Color' => "red" ));