@hitkeep/tracker 2.12.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/LICENSE +21 -0
- package/README.md +164 -0
- package/dist/core.d.cts +83 -0
- package/dist/core.d.ts +83 -0
- package/dist/index.cjs +669 -0
- package/dist/index.js +646 -0
- package/dist/package.d.cts +65 -0
- package/dist/package.d.ts +65 -0
- package/dist/version.d.cts +1 -0
- package/dist/version.d.ts +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { EventProperties, HitKeepWindow, TrackerHandle } from './core.js';
|
|
2
|
+
export type { EventProperties, TrackerHandle } from './core.js';
|
|
3
|
+
export { TRACKER_VERSION } from './version.js';
|
|
4
|
+
export interface TrackerConfig {
|
|
5
|
+
/** HitKeep origin the tracker reports to, e.g. `https://stats.example.com` or `https://example.net/hitkeep`. */
|
|
6
|
+
host: string;
|
|
7
|
+
/** Send a pageview on init. Default `true`. */
|
|
8
|
+
autoCapturePageviews?: boolean;
|
|
9
|
+
/** Track history-based SPA navigations as pageviews. Default `true`. */
|
|
10
|
+
autoTrackSpaNavigation?: boolean;
|
|
11
|
+
/** Track clicks on links to other hostnames as `outbound_click`. Default `true`. */
|
|
12
|
+
outboundLinks?: boolean;
|
|
13
|
+
/** Track same-origin file downloads as `file_download`. Default `true`. */
|
|
14
|
+
fileDownloads?: boolean;
|
|
15
|
+
/** Track form submissions as `form_submit`. Default `true`. */
|
|
16
|
+
formSubmissions?: boolean;
|
|
17
|
+
/** Load the Web Vitals bundle from `${host}/hk-vitals.js`. Default `false`. */
|
|
18
|
+
webVitals?: boolean;
|
|
19
|
+
/** Prefer `navigator.sendBeacon` over keepalive fetch. Default `true`. */
|
|
20
|
+
useBeacon?: boolean;
|
|
21
|
+
/** Drop tracking when the browser sends `DNT: 1`. Default `true`. */
|
|
22
|
+
respectDoNotTrack?: boolean;
|
|
23
|
+
/** Track on `localhost`/`127.0.0.1`, which is blocked by default. Default `false`. */
|
|
24
|
+
captureOnLocalhost?: boolean;
|
|
25
|
+
/** Expose `window.hk.event` for snippet-compatible callers. Default `true`. */
|
|
26
|
+
bindToWindow?: boolean;
|
|
27
|
+
/** Attribution source reported with every request. Default `@hitkeep/tracker`. */
|
|
28
|
+
trackerSource?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface EcommerceItem {
|
|
31
|
+
item_id?: string;
|
|
32
|
+
item_name?: string;
|
|
33
|
+
quantity?: number;
|
|
34
|
+
price?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface ItemEventProperties {
|
|
37
|
+
item_id?: string;
|
|
38
|
+
item_name?: string;
|
|
39
|
+
category?: string;
|
|
40
|
+
price?: number;
|
|
41
|
+
currency?: string;
|
|
42
|
+
[key: string]: unknown;
|
|
43
|
+
}
|
|
44
|
+
export interface PurchaseProperties {
|
|
45
|
+
transaction_id: string;
|
|
46
|
+
value: number;
|
|
47
|
+
currency: string;
|
|
48
|
+
items?: EcommerceItem[];
|
|
49
|
+
items_count?: number;
|
|
50
|
+
coupon?: string;
|
|
51
|
+
tax?: number;
|
|
52
|
+
shipping?: number;
|
|
53
|
+
[key: string]: unknown;
|
|
54
|
+
}
|
|
55
|
+
export declare function init(config: TrackerConfig, win?: HitKeepWindow): TrackerHandle;
|
|
56
|
+
export declare function track(name: string, properties?: EventProperties): void;
|
|
57
|
+
export declare function trackPageview(): void;
|
|
58
|
+
export declare function cleanup(): void;
|
|
59
|
+
export declare function blockTrackingForMe(win?: Window): void;
|
|
60
|
+
export declare function enableTrackingForMe(win?: Window): void;
|
|
61
|
+
export declare function isTrackingEnabled(win?: Window): boolean;
|
|
62
|
+
export declare function trackViewItem(properties: ItemEventProperties): void;
|
|
63
|
+
export declare function trackAddToCart(properties: ItemEventProperties): void;
|
|
64
|
+
export declare function trackBeginCheckout(properties: ItemEventProperties): void;
|
|
65
|
+
export declare function trackPurchase(properties: PurchaseProperties): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TRACKER_VERSION = "2.12.0";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TRACKER_VERSION = "2.12.0";
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hitkeep/tracker",
|
|
3
|
+
"version": "2.12.0",
|
|
4
|
+
"description": "Typed, cookieless web analytics tracker for React, Vue, Angular, and Astro. Official browser SDK for HitKeep, a privacy-friendly, self-hostable Google Analytics alternative.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"main": "./dist/index.cjs",
|
|
9
|
+
"module": "./dist/index.js",
|
|
10
|
+
"types": "./dist/package.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": {
|
|
14
|
+
"types": "./dist/package.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"require": {
|
|
18
|
+
"types": "./dist/package.d.cts",
|
|
19
|
+
"default": "./dist/index.cjs"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"./package.json": "./package.json"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"prepublishOnly": "npm --prefix ../dashboard run build:tracker-package"
|
|
31
|
+
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/PascaleBeier/hitkeep.git",
|
|
35
|
+
"directory": "frontend/tracker"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://hitkeep.com",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/PascaleBeier/hitkeep/issues"
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"analytics",
|
|
43
|
+
"web-analytics",
|
|
44
|
+
"website-analytics",
|
|
45
|
+
"privacy",
|
|
46
|
+
"privacy-friendly-analytics",
|
|
47
|
+
"cookieless",
|
|
48
|
+
"gdpr",
|
|
49
|
+
"google-analytics-alternative",
|
|
50
|
+
"self-hosted",
|
|
51
|
+
"tracker",
|
|
52
|
+
"tracking",
|
|
53
|
+
"pageviews",
|
|
54
|
+
"event-tracking",
|
|
55
|
+
"spa",
|
|
56
|
+
"react",
|
|
57
|
+
"vue",
|
|
58
|
+
"angular",
|
|
59
|
+
"astro",
|
|
60
|
+
"typescript",
|
|
61
|
+
"hitkeep"
|
|
62
|
+
],
|
|
63
|
+
"publishConfig": {
|
|
64
|
+
"access": "public",
|
|
65
|
+
"provenance": true
|
|
66
|
+
}
|
|
67
|
+
}
|