Use Plausible Analytics to track visitors and events in your Sylius store.
composer require setono/sylius-plausible-plugin<?php
declare(strict_types=1);
namespace App\Entity\Channel;
use Doctrine\ORM\Mapping as ORM;
use Setono\SyliusPlausiblePlugin\Model\ChannelInterface as PlausibleChannelInterface;
use Setono\SyliusPlausiblePlugin\Model\ChannelPlausibleAwareTrait;
use Sylius\Component\Core\Model\Channel as BaseChannel;
#[ORM\Entity]
#[ORM\Table(name: 'sylius_channel')]
class Channel extends BaseChannel implements PlausibleChannelInterface
{
use ChannelPlausibleAwareTrait;
}# config/routes/setono_sylius_plausible.yaml
setono_sylius_plausible:
resource: "@SetonoSyliusPlausiblePlugin/Resources/config/routes.yaml"bin/console doctrine:migrations:diff
bin/console doctrine:migrations:migrateNavigate to Marketing > Plausible in the admin panel to configure the Plausible script for each channel.
You can enter the Plausible script in any of the following formats:
- Identifier only:
pa-hb0WlWkUb5U3qhSS-vd-a - Full URL:
https://plausible.io/js/pa-hb0WlWkUb5U3qhSS-vd-a.js - HTML snippet:
<script async src="https://plausible.io/js/pa-hb0WlWkUb5U3qhSS-vd-a.js"></script>
The plugin will normalize any of these formats and output the correct script tag on your storefront.