Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,33 @@ Each example also ships a commented-out `scriptOrigin` option (JS init/component

See the Takt docs guide **`/docs/guides/domaine-personnalise`** for how to set up the first-party domain.

## Advanced options (Takt 0.5)

Each example also wires at least one of the advanced tracker options introduced in
Takt 0.5, so you can see the idiomatic spelling per framework (component prop,
plugin/config key, `data-*` attribute, or `init()` field):

| Option | What it does |
|--------|--------------|
| `sampleRate` | Fraction of visitors to track (`0`–`1`); lower it to sample. |
| `trackQuery` | Keep the query string on pageview paths instead of stripping it. |
| `queryParams` | Allowlist of query params to keep when `trackQuery` is on. |
| `scrubUrl` | A function that rewrites each URL before it is sent (dev-controlled). |
| `enabled` | Master kill-switch — set to `false` to disable all tracking at runtime. |
| `tagged` | Autocapture clicks on `[data-takt-tag]` elements. |

Where each option shows up: `vanilla` (`sampleRate`, `tagged`), `react` (`scrubUrl`,
`tagged`), `vue` (`trackQuery`, `queryParams`), `svelte` (`scrubUrl`), `solid`
(`sampleRate`), `angular` (`tagged`), `astro` (`trackQuery`, `queryParams`,
`scrubUrl`).

`scrubUrl` is a function, so it can't be a `data-*` attribute or survive a JSON
config island. In the JS wrappers it is a real prop; for PHP it requires the new
`Mode::Sdk` renderer, which emits a full `import{init};init({…})` ES module — the
[`php`](php) example shows `Mode::Sdk` + `scrubUrl`, and the
[`laravel`](laravel)/[`symfony`](symfony) configs demonstrate the `data-*` options
(with `scrub_url` + `mode: sdk` shown as a commented switch).

## License

MIT
18 changes: 9 additions & 9 deletions angular/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"@angular/core": "^20.0.0",
"@angular/platform-browser": "^20.0.0",
"@angular/router": "^20.0.0",
"@vskstudio/takt-angular": "^0.4.2",
"@vskstudio/takt-core": "^0.4.2",
"@vskstudio/takt-angular": "^0.5.0",
"@vskstudio/takt-core": "^0.5.0",
"rxjs": "^7.8.0",
"tslib": "^2.6.0",
"zone.js": "^0.15.0"
Expand Down
2 changes: 2 additions & 0 deletions angular/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { TaktService, TaktEventDirective } from '@vskstudio/takt-angular';
>
Sign up (declarative)
</button>
<!-- autocaptured by tagged: true (no JS needed) -->
<button data-takt-tag="Newsletter">Subscribe (tagged)</button>
</main>
`,
})
Expand Down
3 changes: 3 additions & 0 deletions angular/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ bootstrapApplication(AppComponent, {
track404: true,
excludeLocalhost: false,
// scriptOrigin: 'https://stats.example.com', // first-party : sert le tracker depuis votre domaine (anti-adblock)
// Advanced options (Takt 0.5):
tagged: true, // autocapture clicks on [data-takt-tag] elements
// enabled: false, // master kill-switch — disables all tracking at runtime
}),
],
}).catch((err) => console.error(err));
13 changes: 12 additions & 1 deletion astro/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,18 @@ import takt from '@vskstudio/takt-astro'
// import Takt from '@vskstudio/takt-astro/Takt.astro' -> <Takt domain="example.com" /> in <head>
export default defineConfig({
integrations: [
// Advanced options (Takt 0.5): keep only the listed query params on pageviews;
// scrubUrl (integration-only — it can't cross the <Takt /> JSON island) rewrites
// each URL before send. It is stringified at build time, so keep it self-contained.
// scriptOrigin: 'https://stats.example.com' -> first-party : sert le tracker depuis votre domaine (anti-adblock)
takt({ domain: 'example.com', endpoint: '/api/event', track404: true, excludeLocalhost: false }),
takt({
domain: 'example.com',
endpoint: '/api/event',
track404: true,
excludeLocalhost: false,
trackQuery: true,
queryParams: ['utm_source', 'utm_medium', 'utm_campaign'],
scrubUrl: (url) => url.split('#')[0],
}),
],
})
18 changes: 9 additions & 9 deletions astro/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"preview": "astro preview"
},
"dependencies": {
"@vskstudio/takt-astro": "^0.4.2",
"@vskstudio/takt-core": "^0.4.2",
"@vskstudio/takt-astro": "^0.5.0",
"@vskstudio/takt-core": "^0.5.0",
"astro": "^5.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion laravel/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"require": {
"php": ">=8.1",
"laravel/framework": "^11.0 || ^12.0",
"vskstudio/takt-laravel": "^0.1"
"vskstudio/takt-laravel": "^0.3"
},
"autoload": { "psr-4": { "App\\": "app/" } },
"config": {
Expand Down
Loading
Loading