DataLook Docs
Install guides

Symfony (PHP)

Install DataLook on Symfony (PHP) — the plain script tag, or the first-party proxy that beats ad blockers. Both on one page.

Add the tag to your Twig base template.

Add the script to base.html.twig <head>

templates/base.html.twig
<script defer src="https://cdn.datalook.app/s.js" data-site="YOUR_SITE_ID"></script>

The proxy install serves both s.js and the collector from your own domain, so ad blockers — which match on domain, not path — can't see us. You rewrite one innocuous path prefix to our CDN; the script figures out the rest.

A controller forwards the prefix with HttpClient.

Add the controller

src/Controller/DatalookController.php
<?phpnamespace App\Controller;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\HttpFoundation\Response;use Symfony\Component\Routing\Attribute\Route;use Symfony\Contracts\HttpClient\HttpClientInterface;class DatalookController{    public function __construct(private HttpClientInterface $client) {}    #[Route('/_axis/{path}', requirements: ['path' => '.*'], methods: ['GET', 'POST'])]    public function proxy(Request $request, string $path): Response    {        $up = $this->client->request($request->getMethod(), "https://cdn.datalook.app/$path", [            'body' => $request->getContent(),            'headers' => [                'Content-Type' => $request->headers->get('Content-Type', 'text/plain'),                'X-Forwarded-For' => $request->getClientIp(),            ],        ]);        return new Response($up->getContent(false), $up->getStatusCode(), [            'Content-Type' => $up->getHeaders(false)['content-type'][0] ?? 'application/octet-stream',        ]);    }}

Point the script at the prefix

<script defer src="/_axis/s.js" data-site="YOUR_SITE_ID"></script>

Heads up

Your server now sits between the visitor and us, so forward the visitor IP (X-Forwarded-For) or your country breakdown will collapse to your server location. The DNS proxy avoids this entirely — see the proxy overview.