{"id":51377197,"url":"https://github.com/vskstudio/takt-angular","last_synced_at":"2026-07-05T21:00:32.864Z","repository":{"id":364355083,"uuid":"1267468059","full_name":"vskstudio/takt-angular","owner":"vskstudio","description":"Idiomatic Angular wrapper for Takt privacy-friendly analytics","archived":false,"fork":false,"pushed_at":"2026-07-01T05:02:19.000Z","size":454,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-01T05:09:01.024Z","etag":null,"topics":["analytics","angular","cookieless","frontend","gdpr","privacy","privacy-friendly","sdk","self-hosted","typescript","web-analytics","wrapper"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vskstudio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-12T15:08:24.000Z","updated_at":"2026-07-01T05:02:23.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/vskstudio/takt-angular","commit_stats":null,"previous_names":["vskstudio/takt-angular"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/vskstudio/takt-angular","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vskstudio%2Ftakt-angular","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vskstudio%2Ftakt-angular/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vskstudio%2Ftakt-angular/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vskstudio%2Ftakt-angular/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vskstudio","download_url":"https://codeload.github.com/vskstudio/takt-angular/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vskstudio%2Ftakt-angular/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35168795,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-05T02:00:06.290Z","response_time":100,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","angular","cookieless","frontend","gdpr","privacy","privacy-friendly","sdk","self-hosted","typescript","web-analytics","wrapper"],"created_at":"2026-07-03T14:00:27.941Z","updated_at":"2026-07-05T21:00:32.858Z","avatar_url":"https://github.com/vskstudio.png","language":"TypeScript","funding_links":[],"categories":["Development Utilities"],"sub_categories":["Analytics"],"readme":"# @vskstudio/takt-angular\n\nIdiomatic Angular wrapper for [Takt](https://github.com/vskstudio/takt-core), privacy-friendly analytics. Standalone APIs for Angular 17+.\n\n## Install\n\n```bash\npnpm add @vskstudio/takt-angular @vskstudio/takt-core\n```\n\n## Setup\n\nRegister Takt once at bootstrap with `provideTakt`. It boots only in the browser, fires the initial pageview, wires up the requested autocapture, and disposes everything when the app is destroyed.\n\n```ts\nimport { bootstrapApplication } from '@angular/platform-browser'\nimport { provideTakt } from '@vskstudio/takt-angular'\nimport { AppComponent } from './app/app.component'\n\nbootstrapApplication(AppComponent, {\n  providers: [\n    provideTakt({\n      // domain defaults to location.hostname, endpoint to /api/event\n      outbound: true, // auto-track outbound links\n      files: true, // auto-track downloads (or pass ['pdf', 'zip'])\n      // spa: true, respectDnt: true, excludeLocalhost: true (defaults)\n    }),\n  ],\n})\n```\n\nSSR-safe: on the server `provideTakt` is inert and `TaktService` no-ops.\n\n## Track events imperatively\n\nInject `TaktService` anywhere. Every method is a never-throwing no-op before init or on the server.\n\n```ts\nimport { Component, inject } from '@angular/core'\nimport { TaktService } from '@vskstudio/takt-angular'\n\n@Component({ /* ... */ })\nexport class CheckoutComponent {\n  private readonly takt = inject(TaktService)\n\n  buy() {\n    this.takt.track('Purchase', {\n      props: { plan: 'pro' },\n      revenue: { amount: '29.00', currency: 'EUR' },\n    })\n  }\n\n  // takt.pageview(), takt.optOut(), takt.optIn() are also available.\n}\n```\n\n## Track clicks declaratively\n\nThe `taktEvent` directive resolves the live instance at click time.\n\n```ts\nimport { TaktEventDirective } from '@vskstudio/takt-angular'\n\n@Component({\n  standalone: true,\n  imports: [TaktEventDirective],\n  template: `\n    \u003cbutton\n      taktEvent=\"Signup\"\n      [taktProps]=\"{ plan: 'pro' }\"\n      [taktRevenue]=\"{ amount: '29.00', currency: 'EUR' }\"\n    \u003e\n      Sign up\n    \u003c/button\u003e\n  `,\n})\nexport class SignupComponent {}\n```\n\n## Widgets\n\nStandalone, server-rendered widget components. The badge is an `\u003cimg\u003e` (SVG), the embed is a sandboxed `\u003ciframe\u003e` (`sandbox=\"allow-scripts allow-same-origin\"`, `referrerpolicy=\"strict-origin-when-cross-origin\"`).\n\n```ts\nimport { TaktBadgeComponent, TaktEmbedComponent } from '@vskstudio/takt-angular'\n\n@Component({\n  standalone: true,\n  imports: [TaktBadgeComponent, TaktEmbedComponent],\n  template: `\n    \u003ctakt-badge domain=\"example.com\" variant=\"d\" glyph=\"dash\" lang=\"fr\" /\u003e\n    \u003ctakt-embed domain=\"example.com\" theme=\"dark\" [width]=\"404\" [height]=\"264\" /\u003e\n  `,\n})\nexport class StatsComponent {}\n```\n\nRead public stats programmatically with `createStats`:\n\n```ts\nimport { createStats } from '@vskstudio/takt-angular'\n\nconst stats = createStats({ domain: 'example.com' })\nconst summary = await stats.summary({ period: '7d' })\nconst series = await stats.timeseries({ period: '30d' })\n```\n\nThe badge `alt` text is an overridable input (defaults to `\"takt\"`). The optional `host` input must be an absolute `http(s)` URL — core validates it and throws on anything else (e.g. a `javascript:` URL).\n\n`badgeUrl`, `embedUrl`, `PublicApiError` and the widget/stats types are re-exported from core.\n\n## Framework-agnostic custom element\n\nFor non-Angular pages (or a plain `\u003cscript\u003e` tag), use the self-contained `\u003ctakt-analytics\u003e` element. Privacy attributes are on by default; set them to `false` to disable.\n\n```ts\nimport { defineTaktElement } from '@vskstudio/takt-angular/element'\ndefineTaktElement() // also auto-runs on import\n```\n\n```html\n\u003ctakt-analytics domain=\"example.com\" outbound files\u003e\u003c/takt-analytics\u003e\n```\n\nVia CDN (bundles core, no build step):\n\n```html\n\u003cscript type=\"module\" src=\"https://unpkg.com/@vskstudio/takt-angular/dist/element/index.js\"\u003e\u003c/script\u003e\n\u003ctakt-analytics\u003e\u003c/takt-analytics\u003e\n```\n\n## API\n\n| Export | Description |\n| --- | --- |\n| `provideTakt(config?)` | `EnvironmentProviders` — install at bootstrap. |\n| `TaktService` | Injectable: `track`, `pageview`, `optOut`, `optIn`, `instance`. |\n| `TaktEventDirective` | `[taktEvent]` standalone directive for click tracking. |\n| `TaktBadgeComponent` | `\u003ctakt-badge\u003e` standalone component — server-rendered SVG badge. |\n| `TaktEmbedComponent` | `\u003ctakt-embed\u003e` standalone component — server-rendered iframe. |\n| `createStats(opts?)` | Public stats client (`summary`/`timeseries`/`realtime`/`breakdown`). |\n| `TAKT_CONFIG` | InjectionToken holding the resolved config. |\n| `defineTaktElement` | Registers `\u003ctakt-analytics\u003e` (from `./element`). |\n\n### `TaktConfig`\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `domain` | `location.hostname` | Site identifier sent with every event. |\n| `endpoint` | `/api/event` | Ingestion endpoint. |\n| `scriptOrigin` | — | First-party origin (`{origin}/api/event`); `endpoint` takes precedence. |\n| `outbound` | `false` | Auto-track outbound link clicks. |\n| `files` | `false` | Auto-track file downloads (or pass `string[]` to restrict extensions). |\n| `track404` | `false` | Report a `404` event on error pages (`[data-takt-404]` / `\u003cmeta name=\"takt:404\"\u003e`). |\n| `spa` | `true` | Track SPA navigations (pushState / replaceState / popstate). |\n| `respectDnt` | `true` | Suppress events when the browser's Do Not Track is enabled. |\n| `excludeLocalhost` | `true` | Suppress events on localhost and private IP ranges. |\n| `enabled` | `true` | Set to `false` to disable tracking entirely. |\n| `sampleRate` | `1` | Fraction of sessions to record, between `0` and `1`. |\n| `trackQuery` | `false` | Include the query string in page URLs sent with events. |\n| `queryParams` | `[]` | Allowlist of query-param names to keep when `trackQuery` is on. |\n| `exclude` | `[]` | Path prefixes never tracked, e.g. `['/app', '/account']` (segment-bounded, checked at send time). |\n| `scrubUrl` | — | Transform the URL before it is sent. Function prop — dev-controlled, config only (cannot be set via the `\u003ctakt-analytics\u003e` element attribute). |\n| `tagged` | `false` | Auto-track clicks on `[data-takt-tag]` elements. |\n\n## License\n\nMIT © VSK Studio\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvskstudio%2Ftakt-angular","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvskstudio%2Ftakt-angular","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvskstudio%2Ftakt-angular/lists"}