@levo-so/insights 0.1.109 → 0.1.113

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.
@@ -1,3 +1,4 @@
1
+ import { IIdentityReferrer } from '../types/identity';
1
2
  /**
2
3
  * Extract referrer information for the current page.
3
4
  *
@@ -9,16 +10,21 @@
9
10
  * Handles array-to-string conversion for UTM params that may come
10
11
  * as arrays from the parser.
11
12
  *
13
+ * GA-parity (last-non-direct-click): getVisitorSource returns `internalLink` whenever
14
+ * document.referrer is the SAME site — which happens when the server cuts a session
15
+ * (30-min inactivity) and the visitor keeps browsing. Google Analytics has no
16
+ * `internalLink` channel; it carries the ORIGINAL source forward. So we remember the
17
+ * last real (non-direct, non-internal) channel and restore it in place of
18
+ * `internalLink`, falling back to `direct` when there is no prior source.
19
+ *
20
+ * Example: land via google (`search`) → idle 31 min → keep clicking → the server cuts
21
+ * a new session and document.referrer is the prior same-site page (`internalLink`).
22
+ * We report `search` (matching GA) instead of inventing an `internalLink` channel.
23
+ *
24
+ * Returns one concrete shape for every branch (SSR early-return, internalLink
25
+ * restore, normal). `type` is "" when there is no referrer, so the consumer's
26
+ * `referrer?.type` guard still treats it as "no referrer".
27
+ *
12
28
  * @returns Referrer information object
13
29
  */
14
- export declare const getReferrer: () => {
15
- type?: undefined;
16
- referrer?: undefined;
17
- data?: undefined;
18
- raw?: undefined;
19
- } | {
20
- type: string;
21
- referrer: Record<string, string>;
22
- data: Record<string, string>;
23
- raw: string;
24
- };
30
+ export declare const getReferrer: () => IIdentityReferrer;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@levo-so/insights",
3
3
  "description": "Levo analytics",
4
- "version": "0.1.109",
4
+ "version": "0.1.113",
5
5
  "author": "Levo Engineering <devs@theinternetfolks.com>",
6
6
  "dependencies": {
7
7
  "@analytics/activity-utils": "0.2.2",
@@ -17,7 +17,7 @@
17
17
  "typescript": "5.9.3",
18
18
  "vite": "8.0.8",
19
19
  "vite-plugin-dts": "4.5.4",
20
- "@levo-so/core": "0.1.109",
20
+ "@levo-so/core": "0.1.113",
21
21
  "@levo/ts-config": "0.0.0"
22
22
  },
23
23
  "exports": {
@@ -38,7 +38,7 @@
38
38
  "main": "./dist/index.js",
39
39
  "module": "./dist/index.js",
40
40
  "peerDependencies": {
41
- "@levo-so/core": "0.1.109"
41
+ "@levo-so/core": "0.1.113"
42
42
  },
43
43
  "publishConfig": {
44
44
  "access": "public"