@vskstudio/takt-astro 0.3.2 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -45,8 +45,10 @@ Both the integration and the component accept the same options:
45
45
  | --- | --- | --- | --- |
46
46
  | `domain` | `string` | `location.hostname` | Site identifier sent with every event. |
47
47
  | `endpoint` | `string` | `/api/event` | Ingestion endpoint. |
48
+ | `scriptOrigin` | `string` | – | First-party origin to derive the endpoint from (`{origin}/api/event`) — your Takt domain or a custom domain to dodge ad-blockers (endpoint wins over it). |
48
49
  | `outbound` | `boolean` | `false` | Auto-track outbound link clicks. |
49
50
  | `files` | `boolean` | `false` | Auto-track file downloads. |
51
+ | `track404` | `boolean` | `false` | Report a `404` event when the page is an error page (`[data-takt-404]` / `<meta name="takt:404">` marker, or a 404 HTTP status). |
50
52
  | `spa` | `boolean` | `true` | Track client-side navigations. |
51
53
  | `respectDnt` | `boolean` | `true` | Suppress events when Do Not Track is on. |
52
54
  | `excludeLocalhost` | `boolean` | `true` | Suppress events on localhost / private IPs. |
@@ -78,7 +80,7 @@ import Embed from '@vskstudio/takt-astro/Embed.astro'
78
80
  <Embed domain="example.com" theme="dark" />
79
81
  ```
80
82
 
81
- `Badge` renders an `<img>` (props: `domain`, `variant`, `glyph`, `lang`, `host`); `Embed` renders an `<iframe>` (props: `domain`, `theme`, `lang`, `host`, `width`, `height`, `title`). Extra attributes pass through to the underlying element, but the built `src` is locked and cannot be overridden. The optional `host` must be an absolute `http(s)` URL — core validates it and throws on anything else (e.g. a `javascript:` URL).
83
+ `Badge` renders an `<img>` (props: `domain`, `variant`, `glyph`, `lang`, `host`). Its `alt` defaults to `"takt"` and can be overridden. `Embed` renders an `<iframe>` (props: `domain`, `theme`, `lang`, `host`, `width`, `height`, `title`); the iframe is sandboxed (`allow-scripts allow-same-origin`) and ships a fixed `referrerpolicy="strict-origin-when-cross-origin"` — both are locked and cannot be weakened by a consumer. Extra attributes pass through to the underlying element, but the built `src` is locked and cannot be overridden. The optional `host` must be an absolute `http(s)` URL — core validates it and throws on anything else (e.g. a `javascript:` URL), and reduces it to its origin (dropping path/query). An empty `host` resolves same-origin.
82
84
 
83
85
  ## Public stats
84
86
 
package/dist/index.d.ts CHANGED
@@ -11,10 +11,20 @@ interface TaktOptions {
11
11
  domain?: string;
12
12
  /** Ingestion endpoint. Defaults to `/api/event`. */
13
13
  endpoint?: string;
14
+ /**
15
+ * First-party origin to derive the endpoint from (`{origin}/api/event`) — your
16
+ * Takt domain or a custom domain to dodge ad-blockers. `endpoint` wins over it.
17
+ */
18
+ scriptOrigin?: string;
14
19
  /** Auto-track outbound link clicks. */
15
20
  outbound?: boolean;
16
21
  /** Auto-track file downloads. */
17
22
  files?: boolean;
23
+ /**
24
+ * Report a `404` event when the page is an error page (`[data-takt-404]` /
25
+ * `<meta name="takt:404">` marker, or a 404 HTTP status).
26
+ */
27
+ track404?: boolean;
18
28
  /** Track client-side navigations (history + Astro View Transitions). Default `true`. */
19
29
  spa?: boolean;
20
30
  /** Suppress events when the browser's Do Not Track is enabled. Default `true`. */
package/dist/index.js CHANGED
@@ -3,8 +3,10 @@ function resolveOptions(options = {}) {
3
3
  return {
4
4
  domain: options.domain,
5
5
  endpoint: options.endpoint,
6
+ scriptOrigin: options.scriptOrigin,
6
7
  outbound: options.outbound ?? false,
7
8
  files: options.files ?? false,
9
+ notFound: options.track404 ?? false,
8
10
  respectDnt: options.respectDnt ?? true,
9
11
  excludeLocalhost: options.excludeLocalhost ?? true,
10
12
  auto: options.spa ?? true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vskstudio/takt-astro",
3
- "version": "0.3.2",
3
+ "version": "0.4.2",
4
4
  "description": "Astro integration for Takt privacy-friendly analytics",
5
5
  "license": "MIT",
6
6
  "author": "VSK Studio",
@@ -45,15 +45,25 @@
45
45
  "engines": {
46
46
  "node": ">=18"
47
47
  },
48
+ "scripts": {
49
+ "build": "tsup",
50
+ "typecheck": "tsc --noEmit",
51
+ "lint": "eslint .",
52
+ "test": "vitest run",
53
+ "e2e": "playwright test",
54
+ "size": "size-limit",
55
+ "prepublishOnly": "pnpm build",
56
+ "release": "pnpm build && changeset publish"
57
+ },
48
58
  "peerDependencies": {
49
- "@vskstudio/takt-core": ">=0.3.1",
59
+ "@vskstudio/takt-core": ">=0.4.2",
50
60
  "astro": ">=4"
51
61
  },
52
62
  "devDependencies": {
53
63
  "@changesets/cli": "^2.31.0",
54
64
  "@playwright/test": "^1.50.0",
55
65
  "@size-limit/preset-small-lib": "^11.1.6",
56
- "@vskstudio/takt-core": "^0.3.2",
66
+ "@vskstudio/takt-core": "^0.4.2",
57
67
  "astro": "^5.0.0",
58
68
  "eslint": "^9.0.0",
59
69
  "size-limit": "^11.1.6",
@@ -62,13 +72,5 @@
62
72
  "typescript-eslint": "^8.0.0",
63
73
  "vitest": "^2.1.0"
64
74
  },
65
- "scripts": {
66
- "build": "tsup",
67
- "typecheck": "tsc --noEmit",
68
- "lint": "eslint .",
69
- "test": "vitest run",
70
- "e2e": "playwright test",
71
- "size": "size-limit",
72
- "release": "pnpm build && changeset publish"
73
- }
74
- }
75
+ "packageManager": "pnpm@9.0.0"
76
+ }