convertloop/convertloop-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

convertloop/convertloop-php

最新稳定版本:0.1.1

Composer 安装命令:

composer require convertloop/convertloop-php

包简介

A PHP client of the ConvertLoop API

README 文档

README

A PHP client of the ConvertLoop REST API. You can sign up for a ConvertLoop account at http://convertloop.co.

Installation

Requirements

PHP 5.3.3 and later.

Composer

To install this library using Composer run the following command:

composer require convertloop/convertloop-php

To use it, use Composer's autoload:

require_once('vendor/autoload.php');

Getting Started

First, you need to create an instance of ConvertLoop\ConvertLoop class passing your app_id and api_key:

$convertloop = new \ConvertLoop\ConvertLoop("app_id", "api_key", "v1");

You are now ready to start calling the API methods:

Creating or updating a person

You need to pass at least one of the following: pid, user_id or email to identify a user. Use pid when you are updating a guest of your site (you can obtain this value from the cookie dp_pid). Use user_id to match the id of the user in your application.

$person = array(
    "email" => "german.escobar@convertloop.co",
    "first_name" => "German",
    "last_name" => "Escobar",
    "plan" => "free"
);
$convertloop->people()->createOrUpdate($person);

Any key different to pid, user_id, email, first_seen_at, last_seen_at, add_to_segments, and remove_from_segments will be treated as a custom attribute of the person.

You can add or remove people from a segment ussing the  add_to_segments and remove_from_segments keys:

$person = array(
    "email" => "german.escobar@convertloop.co",
    "add_to_segments" => array("Learn Something"),
    "remove_from_segments" => array("Segment 1")
);
$convertloop->people()->createOrUpdate($person);

Tracking an event

You can track an event for any person:

$person = array("email" => "german.escobar@convertloop.co");
$event = array(
    "name" => "Billed",
    "person" => $person,
    "metadata" => array("credits" => 1000),
    "ocurred_at" => time()
);
$convertloop->eventLogs()->send($event);

If you don't specify the ocurred_at key, the current time will be used. You can use the person key to add custom attributes to that person, or add or remove that person to/from segments.

统计信息

  • 总下载量: 8.19k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-12-16