@agentuity/analytics 3.0.0-alpha.0
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 +116 -0
- package/dist/beacon.d.ts +12 -0
- package/dist/beacon.d.ts.map +1 -0
- package/dist/beacon.js +300 -0
- package/dist/beacon.js.map +1 -0
- package/dist/client.d.ts +46 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +171 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +32 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +33 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +60 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +92 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +120 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/util.d.ts +37 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +125 -0
- package/dist/util.js.map +1 -0
- package/package.json +54 -0
- package/src/beacon.ts +345 -0
- package/src/client.ts +189 -0
- package/src/config.ts +48 -0
- package/src/index.ts +124 -0
- package/src/types.ts +126 -0
- package/src/util.ts +123 -0
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics configuration resolution
|
|
3
|
+
*/
|
|
4
|
+
import type { AnalyticsConfig } from './types';
|
|
5
|
+
/** Window with Agentuity analytics globals */
|
|
6
|
+
declare global {
|
|
7
|
+
interface Window {
|
|
8
|
+
__AGENTUITY_ANALYTICS__?: AnalyticsConfig;
|
|
9
|
+
agentuityAnalytics?: import('./types').AnalyticsClient;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/** Default collect endpoint */
|
|
13
|
+
export declare const DEFAULT_ENDPOINT = "/_agentuity/webanalytics/collect";
|
|
14
|
+
/** Maximum custom events per page view */
|
|
15
|
+
export declare const MAX_CUSTOM_EVENTS = 1000;
|
|
16
|
+
/**
|
|
17
|
+
* Get analytics config from window global
|
|
18
|
+
*/
|
|
19
|
+
export declare function getConfig(): AnalyticsConfig | null;
|
|
20
|
+
/**
|
|
21
|
+
* Check if analytics is enabled
|
|
22
|
+
*/
|
|
23
|
+
export declare function isEnabled(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Check if running in dev mode
|
|
26
|
+
*/
|
|
27
|
+
export declare function isDevmode(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Get the collect endpoint
|
|
30
|
+
*/
|
|
31
|
+
export declare function getEndpoint(): string;
|
|
32
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,8CAA8C;AAC9C,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,uBAAuB,CAAC,EAAE,eAAe,CAAC;QAC1C,kBAAkB,CAAC,EAAE,OAAO,SAAS,EAAE,eAAe,CAAC;KACvD;CACD;AAED,+BAA+B;AAC/B,eAAO,MAAM,gBAAgB,qCAAqC,CAAC;AAEnE,0CAA0C;AAC1C,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC;;GAEG;AACH,wBAAgB,SAAS,IAAI,eAAe,GAAG,IAAI,CAElD;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAGnC;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAEpC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics configuration resolution
|
|
3
|
+
*/
|
|
4
|
+
/** Default collect endpoint */
|
|
5
|
+
export const DEFAULT_ENDPOINT = '/_agentuity/webanalytics/collect';
|
|
6
|
+
/** Maximum custom events per page view */
|
|
7
|
+
export const MAX_CUSTOM_EVENTS = 1000;
|
|
8
|
+
/**
|
|
9
|
+
* Get analytics config from window global
|
|
10
|
+
*/
|
|
11
|
+
export function getConfig() {
|
|
12
|
+
return window.__AGENTUITY_ANALYTICS__ ?? null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Check if analytics is enabled
|
|
16
|
+
*/
|
|
17
|
+
export function isEnabled() {
|
|
18
|
+
const config = getConfig();
|
|
19
|
+
return config?.enabled === true;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Check if running in dev mode
|
|
23
|
+
*/
|
|
24
|
+
export function isDevmode() {
|
|
25
|
+
return getConfig()?.isDevmode ?? false;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get the collect endpoint
|
|
29
|
+
*/
|
|
30
|
+
export function getEndpoint() {
|
|
31
|
+
return getConfig()?.endpoint ?? DEFAULT_ENDPOINT;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,+BAA+B;AAC/B,MAAM,CAAC,MAAM,gBAAgB,GAAG,kCAAkC,CAAC;AAEnE,0CAA0C;AAC1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAEtC;;GAEG;AACH,MAAM,UAAU,SAAS;IACxB,OAAO,MAAM,CAAC,uBAAuB,IAAI,IAAI,CAAC;AAC/C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS;IACxB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,OAAO,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS;IACxB,OAAO,SAAS,EAAE,EAAE,SAAS,IAAI,KAAK,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW;IAC1B,OAAO,SAAS,EAAE,EAAE,QAAQ,IAAI,gBAAgB,CAAC;AAClD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agentuity/analytics - Browser analytics for Agentuity applications
|
|
3
|
+
*
|
|
4
|
+
* ## Usage
|
|
5
|
+
*
|
|
6
|
+
* ### Auto-init (drop-in)
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // Just import - uses window.__AGENTUITY_ANALYTICS__ config
|
|
9
|
+
* import '@agentuity/analytics/beacon';
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* ### Programmatic
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { init, track, identify, flush } from '@agentuity/analytics';
|
|
15
|
+
*
|
|
16
|
+
* init({
|
|
17
|
+
* orgId: 'your-org-id',
|
|
18
|
+
* projectId: 'your-project-id',
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* track('button_click', { button: 'signup' });
|
|
22
|
+
* identify('user-123', { email: 'user@example.com' });
|
|
23
|
+
* flush();
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* ### With React
|
|
27
|
+
* ```typescript
|
|
28
|
+
* import { useEffect } from 'react';
|
|
29
|
+
* import { track } from '@agentuity/analytics';
|
|
30
|
+
*
|
|
31
|
+
* function SignupButton() {
|
|
32
|
+
* const handleClick = () => {
|
|
33
|
+
* track('signup_click');
|
|
34
|
+
* };
|
|
35
|
+
* return <button onClick={handleClick}>Sign Up</button>;
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export type { AnalyticsConfig, AnalyticsClient, AnalyticsPayload, PageViewData, ScrollEvent, AnalyticsCustomEvent, GeoLocation, } from './types';
|
|
40
|
+
export { getConfig, isEnabled, isDevmode, getEndpoint, DEFAULT_ENDPOINT, } from './config';
|
|
41
|
+
export { generateId, getVisitorId, getUTMParams, stripQueryString, } from './util';
|
|
42
|
+
export { initClient, track, identify, flush, send, getClient, } from './client';
|
|
43
|
+
/**
|
|
44
|
+
* Initialize analytics with explicit config
|
|
45
|
+
* Alternative to using window.__AGENTUITY_ANALYTICS__
|
|
46
|
+
*/
|
|
47
|
+
export declare function init(config: import('./types').AnalyticsConfig): void;
|
|
48
|
+
/**
|
|
49
|
+
* Get the global analytics client
|
|
50
|
+
*/
|
|
51
|
+
export declare function getAnalytics(): import('./types').AnalyticsClient | null;
|
|
52
|
+
/**
|
|
53
|
+
* Check if user has opted out of analytics via localStorage.
|
|
54
|
+
*/
|
|
55
|
+
export declare function isOptedOut(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Set the analytics opt-out status in localStorage.
|
|
58
|
+
*/
|
|
59
|
+
export declare function setOptOut(optOut: boolean): void;
|
|
60
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAGH,YAAY,EACX,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,WAAW,GACX,MAAM,SAAS,CAAC;AAGjB,OAAO,EACN,SAAS,EACT,SAAS,EACT,SAAS,EACT,WAAW,EACX,gBAAgB,GAChB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACN,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,gBAAgB,GAChB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACN,UAAU,EACV,KAAK,EACL,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,SAAS,GACT,MAAM,UAAU,CAAC;AAElB;;;GAGG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,OAAO,SAAS,EAAE,eAAe,GAAG,IAAI,CAMpE;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,OAAO,SAAS,EAAE,eAAe,GAAG,IAAI,CAKvE;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAMpC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAU/C"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agentuity/analytics - Browser analytics for Agentuity applications
|
|
3
|
+
*
|
|
4
|
+
* ## Usage
|
|
5
|
+
*
|
|
6
|
+
* ### Auto-init (drop-in)
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // Just import - uses window.__AGENTUITY_ANALYTICS__ config
|
|
9
|
+
* import '@agentuity/analytics/beacon';
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* ### Programmatic
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { init, track, identify, flush } from '@agentuity/analytics';
|
|
15
|
+
*
|
|
16
|
+
* init({
|
|
17
|
+
* orgId: 'your-org-id',
|
|
18
|
+
* projectId: 'your-project-id',
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* track('button_click', { button: 'signup' });
|
|
22
|
+
* identify('user-123', { email: 'user@example.com' });
|
|
23
|
+
* flush();
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* ### With React
|
|
27
|
+
* ```typescript
|
|
28
|
+
* import { useEffect } from 'react';
|
|
29
|
+
* import { track } from '@agentuity/analytics';
|
|
30
|
+
*
|
|
31
|
+
* function SignupButton() {
|
|
32
|
+
* const handleClick = () => {
|
|
33
|
+
* track('signup_click');
|
|
34
|
+
* };
|
|
35
|
+
* return <button onClick={handleClick}>Sign Up</button>;
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
// Config utilities
|
|
40
|
+
export { getConfig, isEnabled, isDevmode, getEndpoint, DEFAULT_ENDPOINT, } from './config';
|
|
41
|
+
// Utility functions
|
|
42
|
+
export { generateId, getVisitorId, getUTMParams, stripQueryString, } from './util';
|
|
43
|
+
// Programmatic API
|
|
44
|
+
export { initClient, track, identify, flush, send, getClient, } from './client';
|
|
45
|
+
/**
|
|
46
|
+
* Initialize analytics with explicit config
|
|
47
|
+
* Alternative to using window.__AGENTUITY_ANALYTICS__
|
|
48
|
+
*/
|
|
49
|
+
export function init(config) {
|
|
50
|
+
if (typeof window !== 'undefined') {
|
|
51
|
+
window.__AGENTUITY_ANALYTICS__ = config;
|
|
52
|
+
// Import beacon to trigger auto-init
|
|
53
|
+
import('./beacon');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get the global analytics client
|
|
58
|
+
*/
|
|
59
|
+
export function getAnalytics() {
|
|
60
|
+
if (typeof window !== 'undefined' && window.agentuityAnalytics) {
|
|
61
|
+
return window.agentuityAnalytics;
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Check if user has opted out of analytics via localStorage.
|
|
67
|
+
*/
|
|
68
|
+
export function isOptedOut() {
|
|
69
|
+
try {
|
|
70
|
+
return localStorage.getItem('agentuity_opt_out') === 'true';
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Set the analytics opt-out status in localStorage.
|
|
78
|
+
*/
|
|
79
|
+
export function setOptOut(optOut) {
|
|
80
|
+
try {
|
|
81
|
+
if (optOut) {
|
|
82
|
+
localStorage.setItem('agentuity_opt_out', 'true');
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
localStorage.removeItem('agentuity_opt_out');
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
// localStorage not available
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=index.js.map
|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C,CAAC;QACnD,CAAC;aAAM,CAAC;YACP,YAAY,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;QAC9C,CAAC;IACF,CAAC;IAAC,MAAM,CAAC;QACR,6BAA6B;IAC9B,CAAC;AACF,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics type definitions
|
|
3
|
+
*/
|
|
4
|
+
/** Scroll depth milestone event */
|
|
5
|
+
export interface ScrollEvent {
|
|
6
|
+
depth: number;
|
|
7
|
+
timestamp: number;
|
|
8
|
+
}
|
|
9
|
+
/** Custom analytics event */
|
|
10
|
+
export interface AnalyticsCustomEvent {
|
|
11
|
+
timestamp: number;
|
|
12
|
+
name: string;
|
|
13
|
+
data: string;
|
|
14
|
+
}
|
|
15
|
+
/** Geo location data from IP */
|
|
16
|
+
export interface GeoLocation {
|
|
17
|
+
country?: string;
|
|
18
|
+
country_latitude?: string | number;
|
|
19
|
+
country_longitude?: string | number;
|
|
20
|
+
region?: string;
|
|
21
|
+
region_latitude?: string | number;
|
|
22
|
+
region_longitude?: string | number;
|
|
23
|
+
city?: string;
|
|
24
|
+
city_latitude?: string | number;
|
|
25
|
+
city_longitude?: string | number;
|
|
26
|
+
timezone?: string;
|
|
27
|
+
latitude?: string | number;
|
|
28
|
+
longitude?: string | number;
|
|
29
|
+
}
|
|
30
|
+
/** Page view data collected by the beacon */
|
|
31
|
+
export interface PageViewData {
|
|
32
|
+
id: string;
|
|
33
|
+
timestamp: number;
|
|
34
|
+
timezone_offset: number;
|
|
35
|
+
url: string;
|
|
36
|
+
path: string;
|
|
37
|
+
referrer: string;
|
|
38
|
+
title: string;
|
|
39
|
+
screen_width: number;
|
|
40
|
+
screen_height: number;
|
|
41
|
+
viewport_width: number;
|
|
42
|
+
viewport_height: number;
|
|
43
|
+
device_pixel_ratio: number;
|
|
44
|
+
user_agent: string;
|
|
45
|
+
language: string;
|
|
46
|
+
scroll_depth: number;
|
|
47
|
+
time_on_page: number;
|
|
48
|
+
scroll_events: ScrollEvent[];
|
|
49
|
+
custom_events: AnalyticsCustomEvent[];
|
|
50
|
+
load_time?: number;
|
|
51
|
+
dom_ready?: number;
|
|
52
|
+
ttfb?: number;
|
|
53
|
+
fcp?: number;
|
|
54
|
+
lcp?: number;
|
|
55
|
+
cls?: number;
|
|
56
|
+
inp?: number;
|
|
57
|
+
country?: string;
|
|
58
|
+
country_latitude?: number;
|
|
59
|
+
country_longitude?: number;
|
|
60
|
+
region?: string;
|
|
61
|
+
region_latitude?: number;
|
|
62
|
+
region_longitude?: number;
|
|
63
|
+
city?: string;
|
|
64
|
+
city_latitude?: number;
|
|
65
|
+
city_longitude?: number;
|
|
66
|
+
timezone?: string;
|
|
67
|
+
latitude?: number;
|
|
68
|
+
longitude?: number;
|
|
69
|
+
utm_source?: string;
|
|
70
|
+
utm_medium?: string;
|
|
71
|
+
utm_campaign?: string;
|
|
72
|
+
utm_term?: string;
|
|
73
|
+
utm_content?: string;
|
|
74
|
+
[key: string]: unknown;
|
|
75
|
+
}
|
|
76
|
+
/** Analytics configuration */
|
|
77
|
+
export interface AnalyticsConfig {
|
|
78
|
+
/** Enable/disable tracking */
|
|
79
|
+
enabled: boolean;
|
|
80
|
+
/** Organization ID */
|
|
81
|
+
orgId: string;
|
|
82
|
+
/** Project ID */
|
|
83
|
+
projectId: string;
|
|
84
|
+
/** Running in development mode */
|
|
85
|
+
isDevmode?: boolean;
|
|
86
|
+
/** Track clicks on [data-analytics] elements */
|
|
87
|
+
trackClicks?: boolean;
|
|
88
|
+
/** Track scroll depth */
|
|
89
|
+
trackScroll?: boolean;
|
|
90
|
+
/** Track Web Vitals (FCP, LCP, CLS, INP) */
|
|
91
|
+
trackWebVitals?: boolean;
|
|
92
|
+
/** Track JS errors */
|
|
93
|
+
trackErrors?: boolean;
|
|
94
|
+
/** Track SPA navigation */
|
|
95
|
+
trackSPANavigation?: boolean;
|
|
96
|
+
/** Sampling rate (0-1) */
|
|
97
|
+
sampleRate?: number;
|
|
98
|
+
/** Custom collect endpoint */
|
|
99
|
+
endpoint?: string;
|
|
100
|
+
}
|
|
101
|
+
/** Analytics client API */
|
|
102
|
+
export interface AnalyticsClient {
|
|
103
|
+
/** Track a custom event */
|
|
104
|
+
track: (name: string, properties?: Record<string, unknown>) => void;
|
|
105
|
+
/** Identify a user */
|
|
106
|
+
identify: (userId: string, traits?: Record<string, unknown>) => void;
|
|
107
|
+
/** Flush pending events */
|
|
108
|
+
flush: () => void;
|
|
109
|
+
}
|
|
110
|
+
/** Payload sent to collect endpoint */
|
|
111
|
+
export interface AnalyticsPayload {
|
|
112
|
+
org_id: string;
|
|
113
|
+
project_id: string;
|
|
114
|
+
visitor_id: string;
|
|
115
|
+
user_id: string;
|
|
116
|
+
user_traits: Record<string, string>;
|
|
117
|
+
is_devmode: boolean;
|
|
118
|
+
pageview: PageViewData;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,mCAAmC;AACnC,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,6BAA6B;AAC7B,MAAM,WAAW,oBAAoB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACb;AAED,gCAAgC;AAChC,MAAM,WAAW,WAAW;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAClC,gBAAgB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eAAe;IAC/B,2BAA2B;IAC3B,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACpE,sBAAsB;IACtB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACrE,2BAA2B;IAC3B,KAAK,EAAE,MAAM,IAAI,CAAC;CAClB;AAED,uCAAuC;AACvC,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,YAAY,CAAC;CACvB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
package/dist/util.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics utility functions
|
|
3
|
+
*/
|
|
4
|
+
import type { GeoLocation } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Generate a unique ID
|
|
7
|
+
*/
|
|
8
|
+
export declare function generateId(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Safely stringify an object, handling circular references
|
|
11
|
+
*/
|
|
12
|
+
export declare function safeStringify(obj: unknown): string;
|
|
13
|
+
/**
|
|
14
|
+
* Strip query string from URL to prevent sensitive data leakage
|
|
15
|
+
*/
|
|
16
|
+
export declare function stripQueryString(url: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Get UTM parameters from URL
|
|
19
|
+
*/
|
|
20
|
+
export declare function getUTMParams(): Record<string, string>;
|
|
21
|
+
/**
|
|
22
|
+
* Get or create visitor ID from localStorage
|
|
23
|
+
*/
|
|
24
|
+
export declare function getVisitorId(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Get cached geo location
|
|
27
|
+
*/
|
|
28
|
+
export declare function getCachedGeo(): GeoLocation | null;
|
|
29
|
+
/**
|
|
30
|
+
* Cache geo location
|
|
31
|
+
*/
|
|
32
|
+
export declare function setCachedGeo(geo: GeoLocation): void;
|
|
33
|
+
/**
|
|
34
|
+
* Fetch geo location from service
|
|
35
|
+
*/
|
|
36
|
+
export declare function fetchGeo(): Promise<GeoLocation | null>;
|
|
37
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAKnC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAoBlD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQpD;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQrD;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAcrC;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,WAAW,GAAG,IAAI,CAQjD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAMnD;AAED;;GAEG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAS5D"}
|
package/dist/util.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics utility functions
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Generate a unique ID
|
|
6
|
+
*/
|
|
7
|
+
export function generateId() {
|
|
8
|
+
if (typeof crypto !== 'undefined' && crypto.randomUUID) {
|
|
9
|
+
return crypto.randomUUID();
|
|
10
|
+
}
|
|
11
|
+
return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Safely stringify an object, handling circular references
|
|
15
|
+
*/
|
|
16
|
+
export function safeStringify(obj) {
|
|
17
|
+
if (obj === undefined || obj === null) {
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const seen = new WeakSet();
|
|
22
|
+
return JSON.stringify(obj, (_key, value) => {
|
|
23
|
+
if (typeof value === 'object' && value !== null) {
|
|
24
|
+
if (seen.has(value)) {
|
|
25
|
+
return '[Circular]';
|
|
26
|
+
}
|
|
27
|
+
seen.add(value);
|
|
28
|
+
}
|
|
29
|
+
return value;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
34
|
+
console.warn('[Agentuity Analytics] Failed to stringify:', message);
|
|
35
|
+
return `[unserializable: ${message}]`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Strip query string from URL to prevent sensitive data leakage
|
|
40
|
+
*/
|
|
41
|
+
export function stripQueryString(url) {
|
|
42
|
+
if (!url)
|
|
43
|
+
return '';
|
|
44
|
+
try {
|
|
45
|
+
const parsed = new URL(url);
|
|
46
|
+
return parsed.origin + parsed.pathname;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return url.split('?')[0] ?? url;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Get UTM parameters from URL
|
|
54
|
+
*/
|
|
55
|
+
export function getUTMParams() {
|
|
56
|
+
const params = new URLSearchParams(location.search);
|
|
57
|
+
const utm = {};
|
|
58
|
+
for (const key of ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content']) {
|
|
59
|
+
const value = params.get(key);
|
|
60
|
+
if (value)
|
|
61
|
+
utm[key] = value;
|
|
62
|
+
}
|
|
63
|
+
return utm;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get or create visitor ID from localStorage
|
|
67
|
+
*/
|
|
68
|
+
export function getVisitorId() {
|
|
69
|
+
try {
|
|
70
|
+
const stored = localStorage.getItem('agentuity_visitor_id');
|
|
71
|
+
if (stored)
|
|
72
|
+
return stored;
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// localStorage not available
|
|
76
|
+
}
|
|
77
|
+
const id = 'vid_' + generateId();
|
|
78
|
+
try {
|
|
79
|
+
localStorage.setItem('agentuity_visitor_id', id);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// localStorage not available
|
|
83
|
+
}
|
|
84
|
+
return id;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get cached geo location
|
|
88
|
+
*/
|
|
89
|
+
export function getCachedGeo() {
|
|
90
|
+
try {
|
|
91
|
+
const cached = sessionStorage.getItem('agentuity_geo');
|
|
92
|
+
if (cached)
|
|
93
|
+
return JSON.parse(cached);
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
// sessionStorage not available
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Cache geo location
|
|
102
|
+
*/
|
|
103
|
+
export function setCachedGeo(geo) {
|
|
104
|
+
try {
|
|
105
|
+
sessionStorage.setItem('agentuity_geo', JSON.stringify(geo));
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
// sessionStorage not available
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Fetch geo location from service
|
|
113
|
+
*/
|
|
114
|
+
export async function fetchGeo() {
|
|
115
|
+
try {
|
|
116
|
+
const response = await fetch('https://agentuity.sh/location');
|
|
117
|
+
const geo = await response.json();
|
|
118
|
+
setCachedGeo(geo);
|
|
119
|
+
return geo;
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return getCachedGeo();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=util.js.map
|
package/dist/util.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,MAAM,UAAU,UAAU;IACzB,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QACxD,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC;IAC5B,CAAC;IACD,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AACnE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,GAAY;IACzC,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACvC,OAAO,EAAE,CAAC;IACX,CAAC;IACD,IAAI,CAAC;QACJ,MAAM,IAAI,GAAG,IAAI,OAAO,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBACjD,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;oBACrB,OAAO,YAAY,CAAC;gBACrB,CAAC;gBACD,IAAI,CAAC,GAAG,CAAC,KA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AC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentuity/analytics",
|
|
3
|
+
"version": "3.0.0-alpha.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"author": "Agentuity employees and contributors",
|
|
6
|
+
"description": "Browser analytics for Agentuity applications",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
},
|
|
15
|
+
"./beacon": {
|
|
16
|
+
"import": "./dist/beacon.js",
|
|
17
|
+
"types": "./dist/beacon.d.ts"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"README.md",
|
|
22
|
+
"dist",
|
|
23
|
+
"src"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
27
|
+
"build": "bunx tsc --build",
|
|
28
|
+
"typecheck": "bunx tsc --noEmit",
|
|
29
|
+
"prepublishOnly": "bun run clean && bun run build"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/bun": "latest",
|
|
33
|
+
"bun-types": "latest",
|
|
34
|
+
"typescript": "^5.9.0"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"sideEffects": [
|
|
40
|
+
"**/beacon.ts"
|
|
41
|
+
],
|
|
42
|
+
"keywords": [
|
|
43
|
+
"analytics",
|
|
44
|
+
"web-vitals",
|
|
45
|
+
"page-views",
|
|
46
|
+
"browser",
|
|
47
|
+
"agentuity"
|
|
48
|
+
],
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "https://github.com/agentuity/sdk.git",
|
|
52
|
+
"directory": "packages/analytics"
|
|
53
|
+
}
|
|
54
|
+
}
|