定制 wecantrack/api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

wecantrack/api

Composer 安装命令:

composer require wecantrack/api

包简介

PHP wrapper for the WeCanTrack API

README 文档

README

WeCanTrack offers a software solution that helps (affiliate) publishers in their everday business activities, by providing them with insights on which content and campaigns are converting and how much revenue they are generating.

Requirements

  • PHP >= 7.4

Installation

  1. Install package using composer
$ composer require wecantrack/api

Basic Usage

ClickOut URL

use WeCanTrack\API\ClickOut;

$clickOut = (new ClickOut(API_KEY))
                    ->affiliateUrl('https://www.awin1.com/cread.php?awinmid=10921&awinaffid=211395&clickref2=MY&...')
                    ->clickoutUrl('https://your-clickout-url.com/clickout')
                    ->ipAddress('your-ip-address')
                    ->metadata([
                        'custom_1' => 'custom_data',
                        'custom_2' => 'custom_data2',
                    ])
                    ->get();

if($clickOut->isValid()) {
    echo $clickOut->getAffiliateUrl();
    echo $clickOut->getReference(); // return WCT reference. Example: wct200514135314e7x4d
} else {
    var_dump($clickOut->getErrors());
}

Documentation

See Full Documentation

All Network Accounts

use WeCanTrack\API\{Networks, NetworkAccounts};

$accounts = (new NetworkAccounts(API_KEY))->get();

foreach($accounts as $account) {
    echo $account['id'];
    echo $account['name'];
    echo $account['network_id'];
    echo $account['is_enabled'];
    ......
}

echo $accounts->getCount(); // return Accounts count

// get single account data by id
$account = $accounts->findById(123);
echo $account['id'];
echo $account['name'];
echo $account['network_id'];
echo $account['is_enabled'];

All Network Accounts with ID filter

use WeCanTrack\API\{Networks, NetworkAccounts};

$networkAccounts = new NetworkAccounts(API_KEY);
$accounts = $networkAccounts->ids(12)->get(); // get account where its id = 12
// or
$accounts = $networkAccounts->ids([12, 123, 1234])->get(); // get accounts where its ids are 12, 123, 1234

foreach($accounts as $account) {
    echo $account['id'];
    echo $account['name'];
    echo $account['network_id'];
    echo $account['is_enabled'];
    ......
}

echo $accounts->getCount(); // return Accounts count

All websites

use WeCanTrack\API\Websites

$websites = (new Websites(API_KEY))->get();

foreach($websites as $data) {
    echo $data['id'];
    echo $data['url'];
    echo $data['active'];
}
// get single website data by id
$data = $websites->findById(123);
echo $data['id'];
echo $data['url'];
echo $data['active'];

All Transactions

use WeCanTrack\API\Transactions;

$startDate = '2019-01-01';
$endDate = '2019-01-31';

$records = (new Transactions(API_KEY))->get($startDate, $endDate);

foreach($records as $row) {
    echo $row['transaction_id'];
    echo $row['reference']; // return wct200514135314e7x4d
    echo $row['order_date'];
    echo $row['validation_date'];
    echo $row['status'];
    echo $row['sale_amount'];
    echo $row['commission_amount'];
    var_dump($row['click_metadata']);
    ......
}

echo $records->getTotalCount(); // get all record count.

All Transactions With Filter

use WeCanTrack\API\Transactions;

$startDate = '2019-01-01';
$endDate = '2019-01-31';

$records = (new Transactions(API_KEY))
            ->networkAccountId(123)
            ->status([
                Transactions::STATUS_PENDING,
                Transactions::STATUS_APPROVED,
            ])
            ->get($startDate, $endDate, Transactions::LAST_WCT_UPDATE);

foreach($records as $row) {
    echo $row['transaction_id'];
    echo $row['reference']; // return wct200514135314e7x4d
    ......
}

echo $records->getTotalCount(); // get all record count.

Get All Transactions With Limit

use WeCanTrack\API\Transactions;

$startDate = '2019-01-01';
$endDate = '2019-01-31';

$records = (new Transactions(API_KEY))
            ->status([
                Transactions::STATUS_PENDING,
            ])
            ->get($startDate, $endDate);

// every page request return max 500 rows only
foreach($records->limit(500) as $row) {
    echo $row['transaction_id'];
    echo $row['reference']; // return wct200514135314e7x4d
    ......
}

echo $records->getTotalCount(); // get all record count.

Get All Transactions For a Page

use WeCanTrack\API\Transactions;

$startDate = '2019-01-01';
$endDate = '2019-01-31';

$records = (new Transactions(API_KEY))
            ->status([
                Transactions::STATUS_PENDING,
            ])
            ->get($startDate, $endDate);

// return max 600 rows from page 3 only.
foreach($records->limit(600)->page(3) as $row) {
    echo $row['transaction_id'];
    echo $row['reference']; // return wct200514135314e7x4d
    ......
}

echo $records->getTotalCount(); // get all record count.
echo $records->getCount(); // get the rows count for current page.

Utilities

use WeCanTrack\Helper\Utilities;

echo Utilities::extractReference($url); // return wct200514135314e7x4d

License

The WeCanTrack PHP API is licensed under the MIT License. See the LICENSE file for details

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-11-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固