@zaplier/sdk 1.0.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.
Files changed (97) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +144 -0
  3. package/dist/index.cjs +11092 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.ts +1204 -0
  6. package/dist/index.esm.js +11059 -0
  7. package/dist/index.esm.js.map +1 -0
  8. package/dist/index.js +3517 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/sdk.js +11098 -0
  11. package/dist/sdk.js.map +1 -0
  12. package/dist/sdk.min.js +7 -0
  13. package/dist/src/index.d.ts +15 -0
  14. package/dist/src/index.d.ts.map +1 -0
  15. package/dist/src/modules/anti-adblock.d.ts +108 -0
  16. package/dist/src/modules/anti-adblock.d.ts.map +1 -0
  17. package/dist/src/modules/bot-detection.d.ts +15 -0
  18. package/dist/src/modules/bot-detection.d.ts.map +1 -0
  19. package/dist/src/modules/fingerprint/accessibility.d.ts +155 -0
  20. package/dist/src/modules/fingerprint/accessibility.d.ts.map +1 -0
  21. package/dist/src/modules/fingerprint/audio.d.ts +16 -0
  22. package/dist/src/modules/fingerprint/audio.d.ts.map +1 -0
  23. package/dist/src/modules/fingerprint/browser-apis.d.ts +108 -0
  24. package/dist/src/modules/fingerprint/browser-apis.d.ts.map +1 -0
  25. package/dist/src/modules/fingerprint/browser.d.ts +14 -0
  26. package/dist/src/modules/fingerprint/browser.d.ts.map +1 -0
  27. package/dist/src/modules/fingerprint/canvas.d.ts +14 -0
  28. package/dist/src/modules/fingerprint/canvas.d.ts.map +1 -0
  29. package/dist/src/modules/fingerprint/confidence.d.ts +89 -0
  30. package/dist/src/modules/fingerprint/confidence.d.ts.map +1 -0
  31. package/dist/src/modules/fingerprint/datetime-locale.d.ts +76 -0
  32. package/dist/src/modules/fingerprint/datetime-locale.d.ts.map +1 -0
  33. package/dist/src/modules/fingerprint/device-signals.d.ts +29 -0
  34. package/dist/src/modules/fingerprint/device-signals.d.ts.map +1 -0
  35. package/dist/src/modules/fingerprint/dom-blockers.d.ts +56 -0
  36. package/dist/src/modules/fingerprint/dom-blockers.d.ts.map +1 -0
  37. package/dist/src/modules/fingerprint/font-preferences.d.ts +55 -0
  38. package/dist/src/modules/fingerprint/font-preferences.d.ts.map +1 -0
  39. package/dist/src/modules/fingerprint/fonts-enhanced.d.ts +43 -0
  40. package/dist/src/modules/fingerprint/fonts-enhanced.d.ts.map +1 -0
  41. package/dist/src/modules/fingerprint/fonts.d.ts +14 -0
  42. package/dist/src/modules/fingerprint/fonts.d.ts.map +1 -0
  43. package/dist/src/modules/fingerprint/hardware.d.ts +40 -0
  44. package/dist/src/modules/fingerprint/hardware.d.ts.map +1 -0
  45. package/dist/src/modules/fingerprint/hashing.d.ts +28 -0
  46. package/dist/src/modules/fingerprint/hashing.d.ts.map +1 -0
  47. package/dist/src/modules/fingerprint/incognito.d.ts +6 -0
  48. package/dist/src/modules/fingerprint/incognito.d.ts.map +1 -0
  49. package/dist/src/modules/fingerprint/math-enhanced.d.ts +70 -0
  50. package/dist/src/modules/fingerprint/math-enhanced.d.ts.map +1 -0
  51. package/dist/src/modules/fingerprint/math.d.ts +32 -0
  52. package/dist/src/modules/fingerprint/math.d.ts.map +1 -0
  53. package/dist/src/modules/fingerprint/plugins-enhanced.d.ts +97 -0
  54. package/dist/src/modules/fingerprint/plugins-enhanced.d.ts.map +1 -0
  55. package/dist/src/modules/fingerprint/screen.d.ts +15 -0
  56. package/dist/src/modules/fingerprint/screen.d.ts.map +1 -0
  57. package/dist/src/modules/fingerprint/storage.d.ts +45 -0
  58. package/dist/src/modules/fingerprint/storage.d.ts.map +1 -0
  59. package/dist/src/modules/fingerprint/system.d.ts +40 -0
  60. package/dist/src/modules/fingerprint/system.d.ts.map +1 -0
  61. package/dist/src/modules/fingerprint/webgl.d.ts +15 -0
  62. package/dist/src/modules/fingerprint/webgl.d.ts.map +1 -0
  63. package/dist/src/modules/fingerprint.d.ts +35 -0
  64. package/dist/src/modules/fingerprint.d.ts.map +1 -0
  65. package/dist/src/modules/global-interface.d.ts +141 -0
  66. package/dist/src/modules/global-interface.d.ts.map +1 -0
  67. package/dist/src/modules/heatmap.d.ts +140 -0
  68. package/dist/src/modules/heatmap.d.ts.map +1 -0
  69. package/dist/src/modules/incognito-detection.d.ts +23 -0
  70. package/dist/src/modules/incognito-detection.d.ts.map +1 -0
  71. package/dist/src/modules/session-replay.d.ts +132 -0
  72. package/dist/src/modules/session-replay.d.ts.map +1 -0
  73. package/dist/src/modules/user-agent.d.ts +35 -0
  74. package/dist/src/modules/user-agent.d.ts.map +1 -0
  75. package/dist/src/sdk.d.ts +227 -0
  76. package/dist/src/sdk.d.ts.map +1 -0
  77. package/dist/src/types/config.d.ts +44 -0
  78. package/dist/src/types/config.d.ts.map +1 -0
  79. package/dist/src/types/detection.d.ts +114 -0
  80. package/dist/src/types/detection.d.ts.map +1 -0
  81. package/dist/src/types/events.d.ts +174 -0
  82. package/dist/src/types/events.d.ts.map +1 -0
  83. package/dist/src/types/fingerprint.d.ts +157 -0
  84. package/dist/src/types/fingerprint.d.ts.map +1 -0
  85. package/dist/src/types/index.d.ts +83 -0
  86. package/dist/src/types/index.d.ts.map +1 -0
  87. package/dist/src/types/methods.d.ts +83 -0
  88. package/dist/src/types/methods.d.ts.map +1 -0
  89. package/dist/src/types/visitor.d.ts +90 -0
  90. package/dist/src/types/visitor.d.ts.map +1 -0
  91. package/dist/src/utils/browser.d.ts +79 -0
  92. package/dist/src/utils/browser.d.ts.map +1 -0
  93. package/dist/src/utils/lazy-loader.d.ts +60 -0
  94. package/dist/src/utils/lazy-loader.d.ts.map +1 -0
  95. package/dist/src/utils/webgl-cache.d.ts +43 -0
  96. package/dist/src/utils/webgl-cache.d.ts.map +1 -0
  97. package/package.json +82 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Zaplier Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,144 @@
1
+ # @zaplier/sdk
2
+
3
+ **Advanced privacy-first tracking SDK with session replay, heatmaps, and anti-adblock technology.**
4
+
5
+ Makes a website visitor identifier from a browser fingerprint with enhanced session recording capabilities.
6
+ Unlike cookies and local storage, fingerprint stays the same in incognito/private mode and even when browser data is purged.
7
+ 100% cookieless analytics tracking with GDPR/LGPD compliance, advanced bot detection, session replay, and heatmaps.
8
+
9
+ ## ✨ Features
10
+
11
+ - 🛡️ **Privacy-First**: 100% cookieless tracking using advanced fingerprinting
12
+ - 🎬 **Session Replay**: Record and replay user sessions with DOM mutation tracking
13
+ - 🔥 **Heatmaps**: Track clicks, scrolls, and user interactions
14
+ - 🚫 **Anti-Adblock**: Multiple transport methods to bypass adblockers
15
+ - 🤖 **Bot Detection**: Advanced bot and fraud detection
16
+ - 🌍 **GDPR Compliant**: Built-in GDPR mode and consent management
17
+
18
+ ## Quick start
19
+
20
+ Get a workspace token:
21
+
22
+ 1. Register a new account at [zaplier.com/signup](https://zaplier.com/signup)
23
+ 2. After registration go to the [dashboard](https://zaplier.com/workspaces) and create a new workspace
24
+ 3. Go to the "API Keys" page, create and copy your workspace token
25
+
26
+ ### Install from NPM
27
+
28
+ ```bash
29
+ npm i @zaplier/sdk
30
+ # or
31
+ yarn add @zaplier/sdk
32
+ ```
33
+
34
+ ```js
35
+ import { Zaplier } from "@zaplier/sdk";
36
+
37
+ // Initialize the SDK
38
+ const zaplier = Zaplier.init({
39
+ token: "your-workspace-token",
40
+ heatmap: true,
41
+ replay: true,
42
+ debug: true, // Enable for development
43
+ });
44
+
45
+ // Track page views (automatic)
46
+ // Page views are tracked automatically
47
+
48
+ // Track conversions
49
+ zaplier.trackPurchase({
50
+ value: 99.99,
51
+ currency: "USD",
52
+ items: [{ id: "product-123", name: "Product Name" }]
53
+ });
54
+
55
+ // Track custom events
56
+ zaplier.track("button_click", {
57
+ button_id: "signup",
58
+ page: "homepage",
59
+ });
60
+
61
+ // Identify users
62
+ zaplier.identify({
63
+ email: "user@example.com",
64
+ name: "John Doe"
65
+ });
66
+
67
+ // Get visitor data
68
+ console.log("Visitor ID:", zaplier.getVisitorId());
69
+ ```
70
+
71
+ ### Alternatively you can install from CDN
72
+
73
+ ```html
74
+ <script src="https://cdn.jsdelivr.net/npm/@zaplier/sdk@1/dist/sdk.min.js"
75
+ data-token="your-workspace-token"
76
+ data-heatmap="true"
77
+ data-replay="true"></script>
78
+ <script>
79
+ // SDK is automatically initialized from data attributes
80
+
81
+ // Track custom events
82
+ Zaplier.track("page_interaction", {
83
+ element: "header_button",
84
+ action: "click",
85
+ });
86
+
87
+ // Track conversions
88
+ Zaplier.trackPurchase({
89
+ value: 99.99,
90
+ currency: "USD",
91
+ items: [{ id: "product-123", name: "Product Name" }]
92
+ });
93
+
94
+ // Get visitor identifier
95
+ console.log("Visitor ID:", Zaplier.getVisitorId());
96
+ </script>
97
+ ```
98
+
99
+ ## Configuration Options
100
+
101
+ ```js
102
+ Zaplier.init({
103
+ token: 'your-workspace-token', // Required: Your workspace token
104
+ heatmap: true, // Enable heatmap tracking
105
+ replay: true, // Enable session replay
106
+ debug: false, // Enable debug mode
107
+ gdprMode: false, // Enable GDPR compliance mode
108
+ allow_localhost: false // Allow tracking on localhost
109
+ });
110
+ ```
111
+
112
+ ## API Reference
113
+
114
+ ### Core Methods
115
+
116
+ - `Zaplier.init(config)` - Initialize the SDK
117
+ - `Zaplier.track(eventType, data?)` - Track custom events
118
+ - `Zaplier.trackPageView(data?)` - Track page views
119
+ - `Zaplier.trackConversion(type, value?, currency?, metadata?)` - Track conversions
120
+ - `Zaplier.identify(userData)` - Identify users
121
+ - `Zaplier.getVisitorId()` - Get current visitor ID
122
+
123
+ ### Heatmap Controls
124
+
125
+ - `Zaplier.heatmap.enable()` - Enable heatmap tracking
126
+ - `Zaplier.heatmap.disable()` - Disable heatmap tracking
127
+ - `Zaplier.heatmap.isRecording()` - Check if recording
128
+
129
+ ### Session Replay Controls
130
+
131
+ - `Zaplier.replay.start()` - Start session recording
132
+ - `Zaplier.replay.stop()` - Stop session recording
133
+ - `Zaplier.replay.isRecording()` - Check if recording
134
+
135
+ ## Anti-Adblock Technology
136
+
137
+ The SDK automatically uses multiple transport methods to ensure data delivery:
138
+
139
+ 1. **Standard Fetch** - Primary method
140
+ 2. **WebSocket** - Real-time fallback
141
+ 3. **Resource Spoofing** - Disguised as CSS/images/fonts
142
+ 4. **WebRTC** - P2P data channel (experimental)
143
+
144
+ Note that you need to replace `your-workspace-token` with a workspace token from the [dashboard](https://zaplier.com/workspaces).