承接 berno/pff2-fb-conversion-api 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

berno/pff2-fb-conversion-api

Composer 安装命令:

composer require berno/pff2-fb-conversion-api

包简介

Module to manage facebook conversion api

README 文档

README

Request common parameters

The basic request sent to the facebook api:

{
   "data": [
      {
         "event_name": "",
         "event_time": 54545454,
         "event_source_url": "",
         "action_source": "website",
         "user_data": {
            "client_ip_address": "",
            "client_user_agent": "",
            "fbp": "",
            "fbc": ""
         },
         "custom_data": {}
      }
   ],
   "test_event_code": ""
}
  • event_name is based on the event and set by the specific method called.
  • event_time is set with the current timestamp value
  • event_source_url is set with the $event_source_url parameter, if it is not specified is replaced with the current request url by default.
  • client_ip_address is set with the $_SERVER['REMOTE_ADDR'] value
  • client_user_agent is set with the $_SERVER['HTTP_USER_AGENT'] value
  • fbp is set with the $_COOKIE['_fbp'] cookie value if it's present
  • fbc is set with the $_COOKIE['_fbc'] cookie value if it's present
  • custom_data depends on the specific event sent, see the event specific documentation.
  • test_event_code is present only if the debug config param is not false

Events

The facebook pixel events managed by the module are:

PageView

To send a PageView event create an action in a controller in which you call sendPageViewEvent():

public function pageViewTrigger() {
    $this->resetViews();
    /** @var Pff2FbConversionApi $fb_conv_api */
    $fb_conv_api = ModuleManager::loadModule('pff2-fb-conversion-api');
    $fb_conv_api->sendPageViewEvent();
}

Insert a render action in the main layout which refers to the action created (for ex. in the Layout_Controller)

<?php $this->renderAction('Layout', 'pageViewTrigger', array())?>

This method does not create a custom data request field.

CompleteRegistration

sendCompleteRegistrationEvent($event_source_url, $user_email, $status)
  • string|null $event_source_url The browser URL where the event happened. The URL must begin with http:// or https:// and should match the verified domain. If null the parameter value is replaced with the absolute url of the request.
  • string|null $user_email User email, if specified it has added to the user_data request field.
  • string $status The status of the registration event, as a string. Example: 'registered'.

example of custom data created:

"custom_data": {
    "status": "registered"
}

InitiateCheckout

sendInitiateCheckoutEvent($event_source_url, $user_email, $value, $currency = "EUR")
  • string|null $event_source_url The browser URL where the event happened. The URL must begin with http:// or https:// and should match the verified domain. If null the parameter value is replaced with the absolute url of the request.
  • string|null User email, if specified it has added to the user_data request field.
  • float $value The total of order when the checkout process begins
  • string $currency The currency for the $value specified. Currency must be a valid ISO 4217 three digit currency code. Example: 'EUR'.

example of custom data created:

"custom_data": {
    "currency": "EUR",
    "value": 100
}

ViewContent

sendViewContentEvent($event_source_url, $user_email, $content_name, $content_ids, $value, $currency = "EUR")
  • string|null $event_source_url The browser URL where the event happened. The URL must begin with http:// or https:// and should match the verified domain. If null the parameter value is replaced with the absolute url of the request.
  • string|null User email, if specified it has added to the user_data request field.
  • string $content_name The name of the page or product associated with the event.
  • [string] $content_ids The content IDs associated with the event in the form ['ABC','123']
  • float $value A numeric value associated with this event.
  • string $currency The currency for the $value specified. Currency must be a valid ISO 4217 three digit currency code. Example: 'EUR'.

example of custom data created:

"custom_data": {
    "currency": "EUR",
    "value": 60.00,
    "content_type": "product",
    "content_name": "Name of the product",
    "content_ids": ["123"]
}

AddToCart

sendAddToCartEvent($event_source_url, $user_email, $contents, $value, $currency = "EUR")
  • string|null $event_source_url The browser URL where the event happened. The URL must begin with http:// or https:// and should match the verified domain. If null the parameter value is replaced with the absolute url of the request.
  • string|null User email, if specified it has added to the user_data request field.
  • [array] $contents array of associative arrays [array("id" => <product_id>, "quantity" => <product_qnt>)]
  • float $value Total cost of the item added (price * quantity).
  • string $currency The currency for the $value specified. Currency must be a valid ISO 4217 three digit currency code. Example: 'EUR'.

example of custom data created:

"custom_data": {
    "value": 100.2,
    "currency": "EUR",
    "contents": [
       {"id": "123", "quantity": 1},
       {"id": "234", "quantity": 3}
    ],
    "content_type": "product"
}

Purchase

sendPurchaseEvent($event_source_url, $user_email, $content_ids, $order_value, $currency = "EUR")
  • string|null $event_source_url The browser URL where the event happened. The URL must begin with http:// or https:// and should match the verified domain. If null the parameter value is replaced with the absolute url of the request.
  • string|null User email, if specified it has added to the user_data request field.
  • [string] $content_ids The content IDs associated with the event in the form ['ABC','123'].
  • float $order_value Total order amount
  • string $currency The currency for the $order_value specified. Currency must be a valid ISO 4217 three digit currency code. Example: 'EUR'.

example of custom data created:

"custom_data": {
    "currency": "EUR",
    "value": 123.45,
    "content_type": "product",
    "content_ids": ["123","234"]
}

berno/pff2-fb-conversion-api 适用场景与选型建议

berno/pff2-fb-conversion-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17 次下载、GitHub Stars 达 5, 最近一次更新时间为 2021 年 09 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「module」 「facebook」 「pff2」 「conversion api」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 berno/pff2-fb-conversion-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 berno/pff2-fb-conversion-api 我们能提供哪些服务?
定制开发 / 二次开发

基于 berno/pff2-fb-conversion-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-09-02