breadhead/yii2-mailchimp-ecommerce-event-pusher
Composer 安装命令:
composer require breadhead/yii2-mailchimp-ecommerce-event-pusher
包简介
MailChimp Ecommerce Event Pusher for Yii2
关键字:
README 文档
README
Send events to mailchimp ecommerce
do migrations:
php yii migrate --migrationPath=@vendor/breadhead/yii2-mailchimp-ecommerce-event-pusher/src/migrations/
Implement your model class from MailchimpEventInterface. This ecommerce module for tracking:
-Cart
-Order
-Customer
-Product
Example of realization:
public function saveMailchimpEvent(string $event_type): MailchimpEvent
{
$event = (new MailchimpEvent())->setEntityId($this->id)->setEntityType(MailchimpEvent::CUSTOMER)->setEventType($event_type)->setData($this->getMailchimpData())->save();
return $event;
}
public function getMailchimpData()
{
return [
'id' => (string)$this->id,
"email_address" =>(string)$this->email,
'opt_in_status' => (bool)$this->subscribe,
'first_name' => (string)$this->name,
'last_name' => (string)$this->last_name,
'orders_count' => count($this->orders),
'total_spent' => (float)OrderModel::find()->where(['status' => OrderModel::PAYED, 'customer_id' => $this->id])->sum('total')
];
}
config:
'components' => [
'mailchimpEventPusher' => function () {
$store_id = <Your mailchimp store id>;
return new \breadhead\mailchimp\MailchimpEventPusher($store_id);
}
]
For sending events:
\Yii::$app->mailchimpEventPusher->getManager()->sendEvent($event)
统计信息
- 总下载量: 64
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2018-03-02