PHP code example of builtbyberry / laravel-site-analytics
1. Go to this page and download the library: Download builtbyberry/laravel-site-analytics library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
builtbyberry / laravel-site-analytics example snippets
namespace App\Analytics;
use BuiltByBerry\SiteAnalytics\Contracts\AnalyticsEventCatalog;
final class WebsiteEventCatalog implements AnalyticsEventCatalog
{
public function contains(string $event): bool
{
return in_array($event, ['page_view', 'reader_signup_requested'], true);
}
public function label(string $event): string
{
return match ($event) {
'page_view' => 'Page view',
'reader_signup_requested' => 'Signup request',
default => $event,
};
}
public function allowedDimensions(string $event): array
{
return [];
}
}