davidrobert / setono-sylius-facebook-plugin-fork
Sylius插件,用于跟踪访客并将数据发送到Facebook
Requires
- php: >=7.4
- ext-json: *
- doctrine/collections: ^1.6
- doctrine/dbal: ^2.13
- doctrine/orm: ^2.12
- facebook/php-business-sdk: ^13.0
- fakerphp/faker: ^1.19
- knplabs/knp-menu: ^3.3
- psr/log: ^1.1 || ^2.0 || ^3.0
- setono/bot-detection-bundle: ^1.7
- setono/client-id-bundle: ^0.2
- setono/client-id-contracts: ^0.2
- setono/consent-bundle: ^0.1
- setono/consent-contracts: ^0.1
- setono/symfony-main-request-trait: ^1.0
- sylius/resource-bundle: ^1.6
- symfony/config: ^4.4 || ^5.2
- symfony/console: ^4.4 || ^5.2
- symfony/dependency-injection: ^4.4 || ^5.2
- symfony/event-dispatcher: ^4.4 || ^5.2
- symfony/form: ^4.4 || ^5.2
- symfony/http-client: ^5.2 || ^6.0
- symfony/http-client-contracts: ^2.4 || ^3.1
- symfony/http-foundation: ^4.4 || ^5.2
- symfony/http-kernel: ^4.4 || ^5.2
- symfony/lock: ^4.4 || ^5.2
- symfony/options-resolver: ^4.4 || ^5.2
- symfony/routing: ^4.4 || ^5.2
- symfony/security-bundle: ^4.4 || ^5.2
- symfony/uid: ^5.2 || ^6.0
- symfony/workflow: ^4.4 || ^5.2
- twig/twig: ^2.0 || ^3.0
- webmozart/assert: ^1.11
Requires (Dev)
- api-platform/core: ^2.6
- friendsofsymfony/oauth-server-bundle: >2.0.0-alpha.0 ^2.0@dev
- lexik/jwt-authentication-bundle: ^2.16
- matthiasnoback/symfony-config-test: ^4.3
- matthiasnoback/symfony-dependency-injection-test: ^4.3
- phpunit/phpunit: ^9.5
- psalm/plugin-phpunit: ^0.17
- psalm/plugin-symfony: ^3.1
- roave/security-advisories: dev-latest
- setono/code-quality-pack: ^2.2
- sylius/admin-api-bundle: ^1.11
- sylius/sylius: ~1.10.14
- symfony/debug-bundle: ^4.4 || ^5.2
- symfony/dotenv: ^4.4 || ^5.2
- symfony/intl: ^4.4 || ^5.2
- symfony/web-profiler-bundle: ^4.4 || ^5.2
- symfony/webpack-encore-bundle: ^1.14
- dev-master
- v1.0.0
- dev-dependabot/composer/facebook/php-business-sdk-tw-16.0
- dev-dependabot/composer/twig/twig-tw-2.15.4
- dev-dependabot/composer/doctrine/orm-tw-2.14
- dev-dependabot/composer/fakerphp/faker-tw-1.21
- dev-dependabot/composer/sylius/resource-bundle-tw-1.8
- dev-dependabot/composer/psalm/plugin-phpunit-tw-0.18
- dev-dependabot/composer/psalm/plugin-symfony-tw-4.0
- dev-dependabot/composer/setono/bot-detection-bundle-tw-1.9
- dev-dependabot/composer/doctrine/collections-tw-1.8
- dev-dependabot/composer/api-platform/core-tw-2.7
This package is not auto-updated.
Last update: 2024-09-21 17:35:09 UTC
README
在Facebook中跟踪用户行为。
安装
步骤 1:下载插件
打开命令行控制台,进入您的项目目录,并执行以下命令以下载此插件的最新稳定版本
$ composer require setono/sylius-facebook-plugin
此命令需要您已全局安装Composer,如Composer文档中的安装章节所述。
步骤 2:启用插件
然后,通过将其添加到项目中config/bundles.php
文件中已注册的插件/包列表中(在SyliusGridBundle
之前)来启用插件
<?php $bundles = [ Setono\ClientIdBundle\SetonoClientIdBundle::class => ['all' => true], Setono\ConsentBundle\SetonoConsentBundle::class => ['all' => true], Setono\BotDetectionBundle\SetonoBotDetectionBundle::class => ['all' => true], Setono\SyliusFacebookPlugin\SetonoSyliusFacebookPlugin::class => ['all' => true], Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true], ];
步骤 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" } setono_sylius_facebook: access_token: '%env(FACEBOOK_ACCESS_TOKEN)%'
# .env ###> setono/sylius-facebook-plugin ### FACEBOOK_ACCESS_TOKEN=<YOUR TOKEN> ###< setono/sylius-facebook-plugin ###
警告!此插件使用https://github.com/Setono/ConsentBundle,默认情况下不会将数据发送到Facebook。
为了在开发环境中解决这个问题,您必须像这样配置ConsentBundle
# config/packages/dev/setono_consent.yaml setono_consent: marketing_granted: true
此配置将默认将营销同意设置为true,这意味着如果您不处理同意,您将默认发送所有事件到Facebook(这可能与GDPR或其他与营销相关的法律相冲突)
步骤 4:导入路由
# config/routes/setono_sylius_facebook.yaml setono_sylius_facebook: resource: "@SetonoSyliusFacebookPlugin/Resources/config/routes.yaml"
步骤 5:更新数据库模式
$ php bin/console doctrine:migrations:diff $ php bin/console doctrine:migrations:migrate
步骤 6:创建像素
当您在Facebook中创建像素时,您将收到一个像素ID。
现在,通过导航到/admin/pixels/new
在您的Sylius商店中创建一个新的像素。请记住启用像素并启用您想跟踪的渠道。
步骤 7. 配置cron
-
将
bin/console setono:sylius-facebook:send-pixel-events
命令添加到您的crontab中。计划必须是每小时或更频繁。见说明。
-
将
bin/console setono:sylius-facebook:cleanup
命令添加到您的crontab中。计划必须是每天或更少。见说明。
步骤 8:您已准备就绪!
跟踪的事件位于EventListener文件夹中。
相关链接
- https://developers.facebook.com/docs/marketing-api/audiences/guides/dynamic-product-audiences/#setuppixel
- https://developers.facebook.com/docs/marketing-api/conversions-api
- https://developers.facebook.com/docs/marketing-api/conversions-api/using-the-api
- https://developers.facebook.com/docs/marketing-api/conversions-api/guides/business-sdk-features
- https://github.com/facebook/facebook-php-business-sdk
贡献
您可以如何贡献
- 将messages和validators翻译成您的母语
- 创建Behat测试,以验证脚本是否在相应的页面上输出
- 创建新的事件订阅者,以处理尚未实现的Facebook事件
谢谢!