. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\I18N; use Illuminate\Support\Collection; /** * Trait ModuleAnalyticsTrait - default implementation of ModuleAnalyticsInterface */ trait ModuleAnalyticsTrait { /** * Should we add this tracker? * * @return bool */ public function analyticsCanShow(): bool { foreach ($this->analyticsParameters() as $parameter) { if ($parameter === '') { return false; } } return true; } /** * A sentence describing what this module does. * * @return string */ public function description(): string { return I18N::translate('Tracking and analytics'); } /** * Form fields to edit the parameters. * * @return string */ public function analyticsFormFields(): string { return ''; } /** * Home page for the service. * * @return string */ public function analyticsHomePageURL(): string { return ''; } /** * The parameters that need to be embedded in the snippet. * * @return string[] */ public function analyticsParameters(): array { return []; } /** * Embed placeholders in the snippet. * * @param string[] $parameters * * @return string */ public function analyticsSnippet(array $parameters): string { return ''; } }