setono / sylius-conversion-attribution-plugin
Setono example plugin for Sylius.
Package info
github.com/Setono/sylius-conversion-attribution-plugin
Type:sylius-plugin
pkg:composer/setono/sylius-conversion-attribution-plugin
Fund package maintenance!
Requires
- php: >=8.1
- doctrine/orm: ^2.0 || ^3.0
- doctrine/persistence: ^2.0 || ^3.0
- setono/bot-detection-bundle: ^1.13
- setono/client-bundle: ^1.1
- setono/composite-compiler-pass: ^1.1
- setono/doctrine-orm-trait: ^1.0
- sylius/core: ^1.0
- sylius/core-bundle: ^1.0
- sylius/resource-bundle: ^1.6
- symfony/cache: ^6.4 || ^7.0
- symfony/config: ^6.4 || ^7.0
- symfony/console: ^6.4 || ^7.0
- symfony/dependency-injection: ^6.4 || ^7.0
- symfony/event-dispatcher: ^6.4 || ^7.0
- symfony/http-foundation: ^6.4 || ^7.0
- symfony/http-kernel: ^6.4 || ^7.0
- symfony/routing: ^6.4 || ^7.0
- symfony/uid: ^6.4 || ^7.0
- twig/twig: ^2.16 || ^3.21
- webmozart/assert: ^1.11
Requires (Dev)
- api-platform/core: ^2.7.16
- babdev/pagerfanta-bundle: ^3.8
- behat/behat: ^3.14
- doctrine/doctrine-bundle: ^2.11
- infection/infection: ^0.27.10
- jms/serializer-bundle: ^4.2
- lexik/jwt-authentication-bundle: ^2.17
- matthiasnoback/symfony-dependency-injection-test: ^4.3 || ^5.1
- phpunit/phpunit: ^9.6.17
- psalm/plugin-phpunit: ^0.18.4
- setono/code-quality-pack: ^2.9
- setono/tag-bag-bundle: ^3.1
- shipmonk/composer-dependency-analyser: ^1.8
- sylius/sylius: ~1.12.19
- symfony/debug-bundle: ^6.4 || ^7.0
- symfony/dotenv: ^6.4 || ^7.0
- symfony/intl: ^6.4 || ^7.0
- symfony/property-info: ^6.4 || ^7.0
- symfony/serializer: ^6.4 || ^7.0
- symfony/web-profiler-bundle: ^6.4 || ^7.0
- symfony/webpack-encore-bundle: ^1.17.2
- willdurand/negotiation: ^3.1
Conflicts
- symfony/serializer: 6.4.23
This package is auto-updated.
Last update: 2026-07-06 13:22:01 UTC
README
See where customers are coming from by attributing conversions directly in your Sylius store
Installation
Download plugin
composer require setono/sylius-conversion-attribution-plugin
Notice that this also installs the setono/client-bundle which is required by this plugin to work properly.
If you want to use the default javascript injection, you should also install the setono/tag-bag-bundle.
See the installation instructions for the setono/tag-bag-bundle here.
Import routes
# config/routes/setono_sylius_conversion_attribution.yaml setono_sylius_conversion_attribution: resource: "@SetonoSyliusConversionAttributionPlugin/Resources/config/routes.yaml"
Extend Customer and Order entities
<?php declare(strict_types=1); namespace App\Entity\Customer; use Doctrine\ORM\Mapping as ORM; use Setono\SyliusConversionAttributionPlugin\Model\CustomerInterface; use Setono\SyliusConversionAttributionPlugin\Model\CustomerTrait; use Sylius\Component\Core\Model\Customer as BaseCustomer; /** * @ORM\Entity * * @ORM\Table(name="sylius_customer") */ class Customer extends BaseCustomer implements CustomerInterface { use CustomerTrait; }
<?php declare(strict_types=1); namespace App\Entity\Order; use Doctrine\ORM\Mapping as ORM; use Setono\SyliusConversionAttributionPlugin\Model\OrderInterface; use Setono\SyliusConversionAttributionPlugin\Model\OrderTrait; use Sylius\Component\Core\Model\Order as BaseOrder; /** * @ORM\Entity * * @ORM\Table(name="sylius_order") */ class Order extends BaseOrder implements OrderInterface { use OrderTrait; }
Migrate your database
php bin/console doctrine:migrations:diff php bin/console doctrine:migrations:migrate
Prune old sources (recommended)
Every tracked hit creates a source row, so the table grows continuously. Schedule the prune
command (for example daily via cron) to delete old rows. By default it keeps 180 days:
php bin/console setono:sylius-conversion-attribution:prune
Notes
Optional runtime dependencies
- The default JavaScript injection requires
setono/tag-bag-bundle. Without it, enabling thejavascriptfeature throws at container build time. Install it, or setsetono_sylius_conversion_attribution.javascript.enabled: falseand inject the tracking snippet yourself. - Bot filtering (both for the injected snippet and the
/trackendpoint) is provided bysetono/bot-detection-bundle, which is installed automatically as a dependency.
Full page cache
The injected tracking snippet embeds a server-resolved client id. If a full page / HTTP cache stores the rendered HTML, every visitor served that cached page shares the same embedded client id, which corrupts attribution. Exclude pages carrying the snippet from full page caching, or only enable the feature on responses that are not cached.
Privacy / GDPR
A source row stores the visitor's IP address and user agent, which are personal data in many
jurisdictions. Keep retention short by scheduling the prune command, and ensure your privacy policy
and consent handling cover this collection (you may need to anonymize or omit the IP depending on your
requirements).