Skip to content

Commit 092c87c

Browse files
committed
feat: add Filament integration for tracking actions with data-pan attribute
1 parent d00cdea commit 092c87c

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,28 @@ Finally, you may start tracking your pages or components adding the `data-pan` a
6060
> [!IMPORTANT]
6161
> Event names must only contain letters, numbers, dashes, and underscores.
6262
63+
## Filament integration
64+
65+
Pan works seamlessly with [Filament](https://filamentphp.com). You can track any Filament action by passing the `data-pan` attribute via `extraAttributes`:
66+
67+
```php
68+
Action::make('subscribe')
69+
->extraAttributes(['data-pan' => 'subscribe-button'])
70+
```
71+
72+
To track **all actions globally**, add the following to a service provider's `boot` method:
73+
74+
```php
75+
use Filament\Actions\Action;
76+
77+
public function boot(): void
78+
{
79+
Action::configureUsing(function (Action $action): void {
80+
$action->extraAttributes(fn () => ['data-pan' => $action->getLabel()]);
81+
});
82+
}
83+
```
84+
6385
## Visualize your product analytics
6486

6587
To visualize your product analytics, you may use the `pan` Artisan command:

0 commit comments

Comments
 (0)