davidrobert / setono-sylius-facebook-plugin-fork
Sylius plugin that tracks visitors and sends the data to Facebook
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 10
Type:sylius-plugin
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-12-14 18:42:29 UTC
README
Track user behavior in Facebook.
Installation
Step 1: Download the plugin
Open a command console, enter your project directory and execute the following command to download the latest stable version of this plugin:
$ composer require setono/sylius-facebook-plugin
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the plugin
Then, enable the plugin by adding it to the list of registered plugins/bundles
in config/bundles.php
file of your project before (!) 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], ];
Step 3: Configure plugin
# 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 ###
Warning! This plugin uses https://github.com/Setono/ConsentBundle and data will not be sent to Facebook by default.
To workaround that on dev environment - you have to configure ConsentBundle like this:
# config/packages/dev/setono_consent.yaml setono_consent: marketing_granted: true
This configuration will make the marketing consent true by default, which means that if you don’t handle consents you will send all events to Facebook by default (which could be against GDPR or other laws related to marketing)
Step 4: Import routing
# config/routes/setono_sylius_facebook.yaml setono_sylius_facebook: resource: "@SetonoSyliusFacebookPlugin/Resources/config/routes.yaml"
Step 5: Update your database schema
$ php bin/console doctrine:migrations:diff $ php bin/console doctrine:migrations:migrate
Step 6: Create a pixel
When you create a pixel in Facebook you receive a pixel id.
Now create a new pixel in your Sylius shop by navigating to /admin/pixels/new
.
Remember to enable the pixel and enable the channels you want to track.
Step 7. Configure cron
-
Add
bin/console setono:sylius-facebook:send-pixel-events
command to your crontab.Schedule must be hourly or more frequently. See notes.
-
Add
bin/console setono:sylius-facebook:cleanup
command to your crontab.Schedule must be daily or less frequently.
Step 8: You're ready!
The events that are tracked are located in the EventListener folder.
Related links
- 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
Contribute
Ways you can contribute:
- Translate messages and validators to your mother tongue
- Create Behat tests that verifies the scripts are outputted on the respective pages
- Create new event subscribers that handle Facebook events which are not implemented
Thank you!