PHPackages                             vskstudio/takt-laravel - 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-laravel

ActiveLibrary[Templating &amp; Views](/categories/templating)

vskstudio/takt-laravel
======================

Laravel integration for Takt analytics: @takt Blade directive + Takt facade for server-side events.

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

Since Jun 12Pushed 3w agoCompare

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

READMEChangelog (2)Dependencies (14)Versions (8)Used By (0)

Takt for Laravel
================

[](#takt-for-laravel)

Laravel integration for [Takt](https://github.com/vskstudio) analytics. Drop a single `@takt`Blade directive in your layout for privacy-friendly client-side tracking, and use the `Takt`facade to send server-side events straight from your application code.

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 10, 11, or 12

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

[](#installation)

```
composer require vskstudio/takt-laravel
```

The service provider and the `Takt` facade are registered automatically through Laravel package auto-discovery. There is nothing else to wire up.

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

[](#configuration)

The package ships with sane defaults and reads everything from your environment. To customise the published config file:

```
php artisan vendor:publish --tag=takt-config
```

This writes `config/takt.php`. All values are environment-driven:

Env variableDefaultDescription`TAKT_DOMAIN``''`The site/domain registered in Takt that data is attributed to.`TAKT_ENDPOINT``https://taktlytics.com`Base URL of your Takt ingest endpoint. Defaults to the hosted Takt origin.`TAKT_SCRIPT_ORIGIN``null`First-party origin to serve the tracker + derive the endpoint from (`{origin}/api/event`) — a custom domain you proxy through to dodge ad-blockers (endpoint wins over it).`TAKT_API_KEY``null`Ingest-scoped API key used for server-side events (see below).`TAKT_MODE``inline`Snippet delivery mode: `inline`, `cdn`, `asset`, or `sdk` (full ES-module `init()`, required for `TAKT_SCRUB_URL`).`TAKT_OUTBOUND``false`Track clicks on outbound links.`TAKT_FILES``false`Track file download clicks.`TAKT_FILE_EXTENSIONS``''`Comma-separated extensions to count as downloads (e.g. `pdf,zip,docx`). Empty keeps the tracker's default list.`TAKT_TAGGED``false`Track elements tagged in HTML with `data-takt-event`.`TAKT_NOT_FOUND``false`Track 404 pageviews.`TAKT_EXCLUDE_LOCALHOST``true`Skip tracking when running on localhost.`TAKT_NONCE``null`CSP nonce for the inline `` (request-scoped — see config notes).`TAKT_SAMPLE_RATE``null`Sample a fraction of hits, e.g. `0.5` keeps ~50%. Unset tracks everything.`TAKT_TRACK_QUERY``null`Keep the raw query string + hash in tracked URLs (default strips them).`TAKT_QUERY_PARAMS``''`Comma-separated query params to keep when `TAKT_TRACK_QUERY` is off (e.g. `utm_source,utm_medium`).`TAKT_EXCLUDE``''`Comma-separated path prefixes never tracked (e.g. `/app,/account`). Requires `TAKT_MODE=sdk`; segment-bounded.`TAKT_RESPECT_DNT``null`Set to `false` to stop honoring the browser Do-Not-Track header.`TAKT_ENABLED``null`Kill-switch: set to `false` to disable tracking entirely.`TAKT_SCRUB_URL``null`Raw JS function to rewrite URLs before sending, e.g. `(u) => u.split('#')[0]`. **Requires `TAKT_MODE=sdk` and is dev-controlled only** — it is injected verbatim into the page; never build it from user input.Example `.env`:

```
TAKT_DOMAIN=example.com
TAKT_ENDPOINT=https://ingest.takt.io
TAKT_API_KEY=ingest_xxxxxxxxxxxxxxxx
TAKT_MODE=inline
```

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

[](#client-side-tracking)

Add the `@takt` directive to the `` of your layout:

```

    @takt

    @yield('content')

```

### Delivery modes

[](#delivery-modes)

`TAKT_MODE` controls how the tracking script is delivered:

- **`inline`** (default) — the script is embedded directly in the rendered HTML. Zero extra network requests, nothing to host.
- **`cdn`** — references the script from the Takt CDN.
- **`asset`** — references a self-hosted copy of the script served from your own application.
- **`sdk`** — loads the full SDK as an ES module and boots it with `init()`. Required for `TAKT_SCRUB_URL` (custom URL rewriting), which cannot be expressed as a data attribute.

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

[](#server-side-events)

Use the `Takt` facade to record events from controllers, jobs, or anywhere in your application:

```
use Vskstudio\Takt\Laravel\Facades\Takt;
use Vskstudio\Takt\Revenue;

// A custom event with properties and revenue
Takt::event('Signup', ['plan' => 'pro'], new Revenue('29.00', 'EUR'));

// A simple pageview
Takt::pageview();
```

Server-side events automatically attribute to the current request's IP address and User-Agent, so they are correlated with the visitor that triggered them. You can optionally pass an explicit URL as the last argument to either method.

> **API key scope:** `TAKT_API_KEY` must be an **ingest-scoped** key bound to the configured `TAKT_DOMAIN`. Keep it server-side only — it is never exposed to the browser.

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

Maturity37

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 ~3 days

Total

7

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 (12 commits)")

---

Tags

analyticsbladecookielessgdprlaravelphpprivacyprivacy-friendlyself-hostedtrackingweb-analyticslaraveltrackingbladeanalyticsprivacytakt

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.2k](/packages/craftcms-cms)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M134](/packages/roots-acorn)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.6k](/packages/simplestats-io-laravel-client)[hasinhayder/tyro-dashboard

Tyro Dashboard - Beautiful admin dashboard for managing Tyro roles, privileges, users, and settings

5443.8k](/packages/hasinhayder-tyro-dashboard)[technikermathe/blade-lucide-icons

A package to easily make use of Lucide icons in your Laravel Blade views.

18421.4k11](/packages/technikermathe-blade-lucide-icons)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

293.1k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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