PHPackages                             vskstudio/takt-symfony - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. vskstudio/takt-symfony

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

vskstudio/takt-symfony
======================

Symfony bundle for Takt analytics: takt() Twig function + autowired Takt service for server-side events.

v0.5.0(3w ago)012MITPHPPHP &gt;=8.1CI passing

Since Jun 12Pushed 3w agoCompare

[ Source](https://github.com/vskstudio/takt-symfony)[ Packagist](https://packagist.org/packages/vskstudio/takt-symfony)[ Docs](https://github.com/vskstudio/takt-symfony)[ RSS](/packages/vskstudio-takt-symfony/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (17)Versions (9)Used By (0)

takt-symfony
============

[](#takt-symfony)

Symfony bundle for [Takt](https://github.com/vskstudio) analytics. It wires the Takt snippet into your templates through a `{{ takt() }}` Twig function and exposes an autowired `Takt` service for server-side events.

Installation
------------

[](#installation)

```
composer require vskstudio/takt-symfony
```

If you use [Symfony Flex](https://symfony.com/doc/current/setup/flex.html), the bundle is enabled automatically. Otherwise add it manually to `config/bundles.php`:

```
return [
    // ...
    Vskstudio\Takt\Symfony\TaktBundle::class => ['all' => true],
];
```

Configuration
-------------

[](#configuration)

Create `config/packages/takt.yaml`:

```
takt:
  domain: 'example.com'
  endpoint: 'https://taktlytics.com'   # defaults to the hosted Takt origin
  script_origin: null   # first-party origin to dodge ad-blockers (see below)
  api_key: '%env(TAKT_API_KEY)%'
  mode: 'inline'   # inline | cdn | asset | sdk (sdk = full ES-module init(), needed for scrub_url)
  outbound: false
  files: false
  file_extensions: []   # e.g. ['pdf', 'zip']; empty keeps the tracker default list
  tagged: false         # track elements marked with data-takt-event
  not_found: false      # track 404 pageviews
  exclude_localhost: true
  nonce: null           # CSP nonce for the inline  (request-scoped)
  # Advanced options — null keeps the tracker defaults.
  sample_rate: null     # e.g. 0.5 keeps ~50% of hits
  track_query: null     # true keeps the raw query string + hash in URLs
  query_params: []      # params to keep when track_query is off, e.g. ['utm_source']
  exclude: []           # path prefixes never tracked, requires mode: sdk (e.g. ['/app','/account'])
  respect_dnt: null     # false stops honoring the Do-Not-Track header
  enabled: null         # false disables tracking entirely (kill-switch)
  scrub_url: null       # raw JS fn to rewrite URLs; requires mode: sdk (dev-controlled only)
```

The `api_key` must be **ingest-scoped and domain-bound**. Keep it out of source control via an environment variable.

`script_origin` is the first-party origin to serve the tracker + derive the endpoint from (`{origin}/api/event`) — your Takt domain or a custom domain you proxy through to dodge ad-blockers (`endpoint` wins over it).

`endpoint` is the server-side ingest base origin. It defaults to the hosted Takt origin `https://taktlytics.com`, so a fresh install works out of the box; set it explicitly to point at a self-hosted or custom ingest origin.

Autocapture is opt-in. `outbound`, `files`, `tagged` and `not_found` each add a token to the single `data-auto` attribute read by the bundled tracker; `file_extensions` narrows which downloads count.

The advanced options map to the engine's `sampleRate`, `trackQuery`, `queryParams`, `respectDnt` and `enabled`. `exclude` maps to the engine's `exclude` (path prefixes never tracked) and, like `scrub_url`, only works in `mode: sdk`. `scrub_url` is a **raw JS function** injected verbatim, so it only works in `mode: sdk` (a full ES-module `init()` render) — keep it dev-controlled and never build it from user input.

Client-side tracking
--------------------

[](#client-side-tracking)

Call the `takt()` Twig function inside the `` of your base template:

```

    {# ... #}
    {{ takt() }}

```

### Modes

[](#modes)

- `inline` — the tracking script is embedded directly in the page.
- `cdn` — a `` tag pointing at the Takt CDN is rendered.
- `asset` — a `` tag pointing at a self-hosted asset is rendered.
- `sdk` — a `` boots the full SDK via `init()`; required for `scrub_url`.

Server-side events
------------------

[](#server-side-events)

Autowire the `Takt` service in any controller or service:

```
use Vskstudio\Takt\Revenue;
use Vskstudio\Takt\Takt;

final class CheckoutController
{
    public function __construct(private readonly Takt $takt)
    {
    }

    public function complete(): Response
    {
        $this->takt->event('Signup', ['plan' => 'pro'], new Revenue('29.00', 'EUR'));
        $this->takt->pageview();

        // ...
    }
}
```

The autowired service is bound to the current request: it automatically attributes events to the request's IP address and User-Agent.

> **Behind a proxy or load balancer?** The attributed IP comes from `Request::getClientIp()`. It only honours `X-Forwarded-For` when the request is trusted, so configure [`framework.trusted_proxies`](https://symfony.com/doc/current/deployment/proxies.html)for the real client IP. Without trusted proxies, clients can spoof the forwarded header — so never treat the attributed IP as authoritative.

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance94

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

8

Last Release

27d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/38018746?v=4)[Akayashuu](/maintainers/Akayashuu)[@Akayashuu](https://github.com/Akayashuu)

---

Top Contributors

[![Akayashuu](https://avatars.githubusercontent.com/u/38018746?v=4)](https://github.com/Akayashuu "Akayashuu (14 commits)")

---

Tags

analyticscookielessgdprphpprivacyprivacy-friendlyself-hostedsymfonytrackingtwigweb-analyticssymfonytwigtrackinganalyticsprivacytakt

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/vskstudio-takt-symfony/health.svg)

```
[![Health](https://phpackages.com/badges/vskstudio-takt-symfony/health.svg)](https://phpackages.com/packages/vskstudio-takt-symfony)
```

###  Alternatives

[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M215](/packages/sulu-sulu)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M605](/packages/shopware-core)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.2k18.1k](/packages/prestashop-prestashop)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

515100.5k3](/packages/web-auth-webauthn-framework)[contao/core-bundle

Contao Open Source CMS

1231.6M2.9k](/packages/contao-core-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
