- Use the correct endpoint (analytics.mattitja.se instead of the non-existent .cloud domain) - Authenticate with the site ingest secret as a Bearer token so the API trusts the forwarded visitor IP and user agent - Forward the visitor Accept-Language header (required by bot detection) - Only track successful GET requests rendering HTML - Short timeouts and a file-based circuit breaker that pauses sending after connection failures or 5xx responses, so no queue, worker or cache is needed and a down API never slows the host site - Log rejected requests instead of failing silently
29 lines
647 B
PHP
29 lines
647 B
PHP
<?php
|
|
|
|
namespace Mattitja\Analytics\Tests;
|
|
|
|
use Mattitja\Analytics\AnalyticsServiceProvider;
|
|
use Orchestra\Testbench\TestCase as Orchestra;
|
|
|
|
class TestCase extends Orchestra
|
|
{
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
}
|
|
|
|
protected function getPackageProviders($app)
|
|
{
|
|
return [
|
|
AnalyticsServiceProvider::class,
|
|
];
|
|
}
|
|
|
|
public function getEnvironmentSetUp($app)
|
|
{
|
|
config()->set('mattitja-analytics.site_key', 'testsiteky');
|
|
config()->set('mattitja-analytics.ingest_secret', 'test-secret');
|
|
config()->set('mattitja-analytics.enabled', true);
|
|
}
|
|
}
|