setono/sylius-facebook-plugin

Sylius 插件,用于追踪访客并将数据发送到 Facebook

安装次数: 44,005

依赖项: 0

建议者: 0

安全: 0

星标: 7

关注者: 2

分支: 17

公开问题: 10

类型:sylius-plugin


README

Latest Version Software License Build Status

在您的商店中跟踪电子商务事件并将它们发送到 Facebook,以在 Facebook 内启用您的营销活动。

安装

步骤 1: 下载插件

composer require setono/sylius-facebook-plugin

步骤 2: 启用插件

然后,通过将其添加到项目中的 config/bundles.php 文件中已注册的插件/包列表中(在 SyliusGridBundle 之前)来启用插件。

<?php
$bundles = [
    // the plugin must be added ABOVE the SyliusGridBundle
    Setono\SyliusFacebookPlugin\SetonoSyliusFacebookPlugin::class => ['all' => true],
    Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true],
    
    // used for filtering bot requests
    Setono\BotDetectionBundle\SetonoBotDetectionBundle::class => ['all' => true],
    
    // this is the underlying bundle we use to track events
    Setono\MetaConversionsApiBundle\SetonoMetaConversionsApiBundle::class => ['all' => true],
    
    // OPTIONAL: See note below
    // Setono\ConsentBundle\SetonoConsentBundle => ['all' => true],
];

可选:如果您想启用同意(即 cookie / GDPR),您可以安装consent 包

步骤 3: 配置插件

# config/packages/setono_sylius_facebook.yaml
imports:
    - { resource: "@SetonoSyliusFacebookPlugin/Resources/config/app/config.yaml" }
    
    # Uncomment next line if you want to load some example pixels via fixtures
    # - { resource: "@SetonoSyliusFacebookPlugin/Resources/config/app/fixtures.yaml" }

步骤 4: 导入路由

# config/routes/setono_sylius_facebook.yaml
setono_sylius_facebook:
    resource: "@SetonoSyliusFacebookPlugin/Resources/config/routes.yaml"

步骤 5: 选择您的 HTTP 客户端实现

您可以安装默认的

composer require kriswallsmith/buzz nyholm/psr7

或者编写您自己的 HTTP 客户端并调用

Client::setHttpClient()
Client::setRequestFactory()
Client::setResponseFactory()
Client::setStreamFactory()

步骤 6: 更新您的数据库模式

$ php bin/console doctrine:migrations:diff
$ php bin/console doctrine:migrations:migrate

步骤 7: 创建一个像素

当您在 Facebook 中创建像素时,您将收到一个像素 ID。

现在通过导航到 /admin/facebook/pixels/new 在您的 Sylius 商店中创建一个新的像素。请记住启用像素并启用您想要跟踪的渠道。

步骤 8: 您已准备好!

被跟踪的事件位于 EventSubscriber 文件夹 中,以下是列表

  • ViewContent(即产品页面查看)
  • 添加到购物车
  • 开始结账
  • 购买
  • ViewCategory(这是一个跟踪分类查看的自定义事件)

相关链接

贡献

您可以如何贡献

谢谢!