xddesigners/shop-affiliate-marketing
Composer 安装命令:
composer require xddesigners/shop-affiliate-marketing
包简介
Adds affiliate marketing s2s postback support to SilverShop orders
README 文档
README
Adds affiliate marketing s2s postback support to SilverShop orders. The module comes with a abstract AffiliateProvider class where implementation for different providers can be based upon. A default implementation for Tune's HasOffers platform already exists.
What it is
Affiliate marketing is used by marketeers to generate leads with affiliate networks. Affilate partners can use links with affliate id's in blog posts for example.
Configuration
Has Offers
You can configure the following parameters on the Has Offers implementation:
XD\Shop\AffiliateMarketing\Providers\HasOffers: default_offer_id: 71 # the default offer to map your conversions to transaction_id_var: 'clickid' # the query parameter name that holds the transaction id affiliate_id_var: 'pub' # the query parameter name that holds the affiliate id
If you work with multiple goals or offers id's and don't want to make use of the default parameter you can extend the HasOffers class:
class HasOffersExtension extends Extension { public function onBeforePostBack(&$query, $order) { // if the order matches the case of the different offer or goal if ($order->matchesDifferentCase()) { $query['offer_id'] = 'my_offer_id'; } } }
Create a custom AffiliateProvider
If you have a different affiliate provider you can extend the abstract AffiliateProvider class and implement the methods sessionFromRequest and doPostBack. The first method is used to get and store the id you need for your postback in the session. The doPostBack method is called by the order when paid and should call the provider's server with the stored id.
class MyAffiliateProvider extends AffiliateProvider { /** * Set the required session data from the request */ public function sessionFromRequest(HTTPRequest $request) { $transactionId = $request->getVar('transaction_id'); $affiliateId = $request->getVar('affiliate_id'); if ($transactionId && $affiliateId) { $session = $request->getSession(); $session->set('MyAffiliateProvider.TransactionID', $transactionId); $session->set('MyAffiliateProvider.AffiliateID', $affiliateId); $session->save($request); } } /** * Handle the postback to the affiliate provider */ public function doPostBack(HTTPRequest $request, Order $order) { // send the postback to your affiliate partners server } }
Configure the injector to use your custom affiliate provider:
SilverStripe\Core\Injector\Injector: AffiliateProvider: class: MyAffiliateProvider
xddesigners/shop-affiliate-marketing 适用场景与选型建议
xddesigners/shop-affiliate-marketing 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16 次下载、GitHub Stars 达 2, 最近一次更新时间为 2021 年 04 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「silverstripe」 「marketing」 「affiliate」 「silvershop」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 xddesigners/shop-affiliate-marketing 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 xddesigners/shop-affiliate-marketing 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 xddesigners/shop-affiliate-marketing 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Goaffpro Affiliate Marketing
Analytics chooser extensions for site settings.
Historical accounting for contacts
agnostic helpers to use as foundation in packages and other project
Extends Mautic Lead Bundle's Lead List (Segment) functionality.
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2021-04-19