setono / sylius-facebook-plugin
Sylius plugin that tracks visitors and sends the data to Facebook
Installs: 45 162
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 2
Forks: 17
Open Issues: 10
Type:sylius-plugin
Requires
- php: >=7.4
- ext-json: *
- doctrine/collections: ^1.6
- doctrine/orm: ^2.12
- fakerphp/faker: ^1.19
- knplabs/knp-menu: ^3.3
- psr/event-dispatcher: ^1.0
- psr/log: ^1.1 || ^2.0 || ^3.0
- setono/meta-conversions-api-bundle: ^0.1
- setono/meta-conversions-api-php-sdk: ^0.2
- sylius/resource-bundle: ^1.6
- symfony/config: ^5.4 || ^6.0
- symfony/dependency-injection: ^5.4 || ^6.0
- symfony/event-dispatcher: ^5.4 || ^6.0
- symfony/form: ^5.4 || ^6.0
- symfony/http-foundation: ^5.4 || ^6.0
- symfony/http-kernel: ^5.4 || ^6.0
- symfony/options-resolver: ^5.4 || ^6.0
- symfony/routing: ^5.4 || ^6.0
- webmozart/assert: ^1.11
Requires (Dev)
- api-platform/core: ^2.7
- friendsofsymfony/oauth-server-bundle: >2.0.0-alpha.0 ^2.0@dev
- kriswallsmith/buzz: ^1.2
- lexik/jwt-authentication-bundle: ^2.16
- matthiasnoback/symfony-config-test: ^4.3
- matthiasnoback/symfony-dependency-injection-test: ^4.3
- nyholm/psr7: ^1.5
- phpunit/phpunit: ^9.5
- psalm/plugin-phpunit: ^0.18
- psalm/plugin-symfony: ^5.0
- setono/code-quality-pack: ^2.4
- setono/tag-bag: ^2.0
- setono/tag-bag-bundle: ^3.0
- sylius/admin-api-bundle: ^1.11
- sylius/sylius: ~1.10.14
- symfony/debug-bundle: ^5.4 || ^6.0
- symfony/dotenv: ^5.4 || ^6.0
- symfony/intl: ^5.4 || ^6.0
- symfony/web-profiler-bundle: ^5.4 || ^6.0
- symfony/webpack-encore-bundle: ^1.14
- 3.x-dev
- v3.0.0-alpha.3
- v3.0.0-alpha.2
- v3.0.0-alpha
- 2.0.x-dev
- v2.0.0
- v2.0.0-alpha.5
- v2.0.0-alpha.4
- v2.0.0-alpha.3
- v2.0.0-alpha.2
- v2.0.0-alpha
- 1.0.x-dev
- v1.0.0-beta.9
- v1.0.0-beta.8
- v1.0.0-beta.7
- v1.0.0-beta.6
- v1.0.0-beta.5
- v1.0.0-beta.4
- v1.0.0-beta.3
- v1.0.0-beta.2
- v1.0.0-beta
- dev-dependabot/composer/setono/tag-bag-tw-2.2
- dev-dependabot/composer/lexik/jwt-authentication-bundle-tw-2.18
- dev-dependabot/composer/phpunit/phpunit-tw-9.6
- dev-dependabot/composer/setono/code-quality-pack-tw-2.4
- dev-dependabot/composer/doctrine/orm-tw-2.14
- dev-dependabot/composer/psalm/plugin-symfony-tw-5.0
- dev-dependabot/composer/fakerphp/faker-tw-1.21
- dev-dependabot/composer/sylius/resource-bundle-tw-1.8
- dev-dependabot/composer/doctrine/collections-tw-1.8
This package is auto-updated.
Last update: 2024-11-26 00:20:00 UTC
README
Track ecommerce events in your store and send them to Facebook to enable your marketing efforts inside Facebook.
Installation
Step 1: Download the plugin
composer require setono/sylius-facebook-plugin
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 = [ // 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], ];
OPTIONAL: If you want to enable consent (i.e. cookie / GDPR) you can install the consent bundle.
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" }
Step 4: Import routing
# config/routes/setono_sylius_facebook.yaml setono_sylius_facebook: resource: "@SetonoSyliusFacebookPlugin/Resources/config/routes.yaml"
Step 5: Choose your HTTP client implementation
Either you can install the default ones :
composer require kriswallsmith/buzz nyholm/psr7
Or write your own HTTP client and call :
Client::setHttpClient() Client::setRequestFactory() Client::setResponseFactory() Client::setStreamFactory()
Step 6: Update your database schema
$ php bin/console doctrine:migrations:diff $ php bin/console doctrine:migrations:migrate
Step 7: 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/facebook/pixels/new
.
Remember to enable the pixel and enable the channels you want to track.
Step 8: You're ready!
The events that are tracked are located in the EventSubscriber folder, but here's a list:
ViewContent
(i.e. product page views)AddToCart
InitiateCheckout
Purchase
ViewCategory
(this is a custom event that tracks taxon views)
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 to your mother tongue
- Create new event subscribers that handle Facebook events which are not implemented
Thank you!