@stacksjs/ts-analytics 0.1.6

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 (237) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/LICENSE.md +21 -0
  3. package/README.md +361 -0
  4. package/bin/cli.ts +169 -0
  5. package/dist/Analytics.d.ts +558 -0
  6. package/dist/api.d.ts +109 -0
  7. package/dist/batching.d.ts +93 -0
  8. package/dist/chunk-2mx7fq49.js +4 -0
  9. package/dist/chunk-3z29508k.js +204 -0
  10. package/dist/chunk-deephkz6.js +56 -0
  11. package/dist/chunk-j261vgyp.js +305 -0
  12. package/dist/chunk-xga17tz7.js +207 -0
  13. package/dist/config.d.ts +132 -0
  14. package/dist/dashboard/components/index.d.ts +80 -0
  15. package/dist/dashboard/composables/useAnalytics.d.ts +99 -0
  16. package/dist/dashboard/index.d.ts +110 -0
  17. package/dist/dashboard/types/index.d.ts +144 -0
  18. package/dist/dashboard/utils/index.d.ts +81 -0
  19. package/dist/dynamodb.d.ts +86 -0
  20. package/dist/funnels.d.ts +104 -0
  21. package/dist/geolocation.d.ts +96 -0
  22. package/dist/index.d.ts +371 -0
  23. package/dist/index.js +10211 -0
  24. package/dist/infrastructure/cdk.d.ts +60 -0
  25. package/dist/infrastructure/cloudformation.d.ts +44 -0
  26. package/dist/infrastructure/index.d.ts +45 -0
  27. package/dist/infrastructure/setup.d.ts +133 -0
  28. package/dist/integrations/cloudflare.d.ts +76 -0
  29. package/dist/integrations/hono.d.ts +60 -0
  30. package/dist/integrations/index.d.ts +24 -0
  31. package/dist/integrations/nuxt.d.ts +7 -0
  32. package/dist/integrations/nuxt.js +42 -0
  33. package/dist/integrations/runtime/use-ts-analytics.d.ts +18 -0
  34. package/dist/integrations/runtime/use-ts-analytics.js +17 -0
  35. package/dist/integrations/stx.d.ts +88 -0
  36. package/dist/integrations/stx.js +18 -0
  37. package/dist/lib/crypto-random.d.ts +4 -0
  38. package/dist/lib/salt.d.ts +16 -0
  39. package/dist/local.d.ts +56 -0
  40. package/dist/model-connector.d.ts +145 -0
  41. package/dist/models/AggregatedStats.d.ts +9 -0
  42. package/dist/models/CampaignStats.d.ts +9 -0
  43. package/dist/models/Conversion.d.ts +11 -0
  44. package/dist/models/CustomEvent.d.ts +11 -0
  45. package/dist/models/DeviceStats.d.ts +9 -0
  46. package/dist/models/EventStats.d.ts +9 -0
  47. package/dist/models/GeoStats.d.ts +9 -0
  48. package/dist/models/Goal.d.ts +9 -0
  49. package/dist/models/GoalStats.d.ts +9 -0
  50. package/dist/models/PageStats.d.ts +11 -0
  51. package/dist/models/PageView.d.ts +13 -0
  52. package/dist/models/RealtimeStats.d.ts +9 -0
  53. package/dist/models/ReferrerStats.d.ts +9 -0
  54. package/dist/models/Session.d.ts +11 -0
  55. package/dist/models/Site.d.ts +11 -0
  56. package/dist/models/index.d.ts +28 -0
  57. package/dist/models/types.d.ts +60 -0
  58. package/dist/sqs-buffering.d.ts +243 -0
  59. package/dist/stacks-integration.d.ts +159 -0
  60. package/dist/tracking-script.d.ts +71 -0
  61. package/dist/tracking.d.ts +17 -0
  62. package/dist/tracking.js +26 -0
  63. package/dist/types.d.ts +595 -0
  64. package/dist/utils/geolocation.d.ts +111 -0
  65. package/dist/utils/user-agent.d.ts +17 -0
  66. package/dist/version.d.ts +7 -0
  67. package/package.json +119 -0
  68. package/src/Analytics.ts +3349 -0
  69. package/src/api.ts +1286 -0
  70. package/src/assets/crosswind.css +2220 -0
  71. package/src/batching.ts +452 -0
  72. package/src/components/dashboard/index.ts +18 -0
  73. package/src/config.ts +456 -0
  74. package/src/dashboard/Dashboard.stx +1517 -0
  75. package/src/dashboard/components/AlertCard.stx +177 -0
  76. package/src/dashboard/components/AnalyticsDashboard.stx +354 -0
  77. package/src/dashboard/components/AnimatedNumber.stx +86 -0
  78. package/src/dashboard/components/BarChart.stx +220 -0
  79. package/src/dashboard/components/BrowserBreakdown.stx +98 -0
  80. package/src/dashboard/components/BrowsersTable.stx +125 -0
  81. package/src/dashboard/components/CampaignBreakdown.stx +163 -0
  82. package/src/dashboard/components/CampaignTable.stx +238 -0
  83. package/src/dashboard/components/CountryList.stx +101 -0
  84. package/src/dashboard/components/DataTable.stx +226 -0
  85. package/src/dashboard/components/DateRangePicker.stx +77 -0
  86. package/src/dashboard/components/DeviceBreakdown.stx +94 -0
  87. package/src/dashboard/components/DevicesTable.stx +163 -0
  88. package/src/dashboard/components/DonutChart.stories.ts +55 -0
  89. package/src/dashboard/components/DonutChart.stx +157 -0
  90. package/src/dashboard/components/EmptyState.stx +90 -0
  91. package/src/dashboard/components/EngagementMetrics.stx +183 -0
  92. package/src/dashboard/components/EventsSection.stx +192 -0
  93. package/src/dashboard/components/FilterBar.stx +104 -0
  94. package/src/dashboard/components/FullAnalyticsDashboard.stx +455 -0
  95. package/src/dashboard/components/FunnelChart.stx +142 -0
  96. package/src/dashboard/components/GeoTable.stx +337 -0
  97. package/src/dashboard/components/GoalsPanel.stx +109 -0
  98. package/src/dashboard/components/Header.stx +39 -0
  99. package/src/dashboard/components/HeatmapChart.stx +140 -0
  100. package/src/dashboard/components/LiveActivityFeed.stx +172 -0
  101. package/src/dashboard/components/MetricComparison.stx +106 -0
  102. package/src/dashboard/components/MiniStats.stx +96 -0
  103. package/src/dashboard/components/OSBreakdown.stx +124 -0
  104. package/src/dashboard/components/PageDetailCard.stx +102 -0
  105. package/src/dashboard/components/PagesTable.stx +127 -0
  106. package/src/dashboard/components/ProgressRing.stx +89 -0
  107. package/src/dashboard/components/RealtimeCounter.stories.ts +45 -0
  108. package/src/dashboard/components/RealtimeCounter.stx +46 -0
  109. package/src/dashboard/components/ReferrersTable.stx +180 -0
  110. package/src/dashboard/components/SparklineChart.stx +160 -0
  111. package/src/dashboard/components/StatCard.stories.ts +58 -0
  112. package/src/dashboard/components/StatCard.stx +90 -0
  113. package/src/dashboard/components/SummaryStats.stx +81 -0
  114. package/src/dashboard/components/TabNav.stx +66 -0
  115. package/src/dashboard/components/ThemeSwitcher.stx +124 -0
  116. package/src/dashboard/components/TimeSeriesChart.stx +106 -0
  117. package/src/dashboard/components/TopList.stories.ts +58 -0
  118. package/src/dashboard/components/TopList.stx +74 -0
  119. package/src/dashboard/components/TrendIndicator.stx +84 -0
  120. package/src/dashboard/components/heatmap/ClickHeatmap.stx +264 -0
  121. package/src/dashboard/components/heatmap/ElementClickList.stx +125 -0
  122. package/src/dashboard/components/heatmap/HeatmapControls.stx +125 -0
  123. package/src/dashboard/components/heatmap/HeatmapLegend.stx +69 -0
  124. package/src/dashboard/components/heatmap/PageHeatmap.stx +264 -0
  125. package/src/dashboard/components/heatmap/ScrollHeatmap.stx +127 -0
  126. package/src/dashboard/components/heatmap/index.ts +12 -0
  127. package/src/dashboard/components/index.ts +86 -0
  128. package/src/dashboard/composables/useAnalytics.ts +465 -0
  129. package/src/dashboard/demo/DemoApp.stx +370 -0
  130. package/src/dashboard/demo/index.ts +8 -0
  131. package/src/dashboard/demo/mockData.ts +234 -0
  132. package/src/dashboard/index.ts +117 -0
  133. package/src/dashboard/stx-shim.d.ts +4 -0
  134. package/src/dashboard/types/index.ts +203 -0
  135. package/src/dashboard/utils/index.ts +426 -0
  136. package/src/dynamodb.ts +344 -0
  137. package/src/funnels.ts +534 -0
  138. package/src/geolocation.ts +515 -0
  139. package/src/handlers/alerts.ts +328 -0
  140. package/src/handlers/annotations.ts +128 -0
  141. package/src/handlers/api-keys.ts +240 -0
  142. package/src/handlers/auth.ts +1020 -0
  143. package/src/handlers/authz.ts +137 -0
  144. package/src/handlers/collect.ts +724 -0
  145. package/src/handlers/data.ts +625 -0
  146. package/src/handlers/experiments.ts +138 -0
  147. package/src/handlers/funnels.ts +216 -0
  148. package/src/handlers/goals.ts +218 -0
  149. package/src/handlers/heatmaps.ts +272 -0
  150. package/src/handlers/index.ts +56 -0
  151. package/src/handlers/lib/read-cache.ts +63 -0
  152. package/src/handlers/misc.ts +486 -0
  153. package/src/handlers/oauth.ts +233 -0
  154. package/src/handlers/performance.ts +388 -0
  155. package/src/handlers/sessions.ts +413 -0
  156. package/src/handlers/sharing.ts +198 -0
  157. package/src/handlers/stats.ts +1368 -0
  158. package/src/handlers/team.ts +161 -0
  159. package/src/handlers/uptime.ts +283 -0
  160. package/src/handlers/views.ts +390 -0
  161. package/src/handlers/webhooks.ts +226 -0
  162. package/src/heatmap/index.ts +32 -0
  163. package/src/heatmap/tracking-script.ts +452 -0
  164. package/src/heatmap/types.ts +79 -0
  165. package/src/index.ts +387 -0
  166. package/src/infrastructure/cdk.ts +496 -0
  167. package/src/infrastructure/cloudformation.ts +595 -0
  168. package/src/infrastructure/index.ts +48 -0
  169. package/src/infrastructure/setup.ts +611 -0
  170. package/src/integrations/cloudflare.ts +732 -0
  171. package/src/integrations/hono.ts +589 -0
  172. package/src/integrations/index.ts +27 -0
  173. package/src/integrations/nuxt.ts +78 -0
  174. package/src/integrations/runtime/use-ts-analytics.ts +32 -0
  175. package/src/integrations/stx.ts +138 -0
  176. package/src/jobs/index.ts +127 -0
  177. package/src/lib/crypto-random.ts +41 -0
  178. package/src/lib/ddb-errors.ts +20 -0
  179. package/src/lib/dynamodb.ts +216 -0
  180. package/src/lib/email.ts +38 -0
  181. package/src/lib/ga-import.ts +471 -0
  182. package/src/lib/ga4-api.ts +244 -0
  183. package/src/lib/goals.ts +205 -0
  184. package/src/lib/index.ts +6 -0
  185. package/src/lib/ingest-counters.ts +123 -0
  186. package/src/lib/log.ts +36 -0
  187. package/src/lib/membership.ts +98 -0
  188. package/src/lib/plans.ts +90 -0
  189. package/src/lib/quota.ts +46 -0
  190. package/src/lib/rate-limit.ts +27 -0
  191. package/src/lib/rollups.ts +472 -0
  192. package/src/lib/salt.ts +97 -0
  193. package/src/lib/scheduler.ts +97 -0
  194. package/src/lib/significance.ts +66 -0
  195. package/src/lib/site-retention.ts +56 -0
  196. package/src/local.ts +360 -0
  197. package/src/model-connector.ts +616 -0
  198. package/src/models/AggregatedStats.ts +162 -0
  199. package/src/models/CampaignStats.ts +141 -0
  200. package/src/models/Conversion.ts +135 -0
  201. package/src/models/CustomEvent.ts +123 -0
  202. package/src/models/DeviceStats.ts +105 -0
  203. package/src/models/EventStats.ts +108 -0
  204. package/src/models/GeoStats.ts +112 -0
  205. package/src/models/Goal.ts +105 -0
  206. package/src/models/GoalStats.ts +106 -0
  207. package/src/models/PageStats.ts +152 -0
  208. package/src/models/PageView.ts +277 -0
  209. package/src/models/RealtimeStats.ts +96 -0
  210. package/src/models/ReferrerStats.ts +115 -0
  211. package/src/models/Session.ts +235 -0
  212. package/src/models/Site.ts +115 -0
  213. package/src/models/index.ts +50 -0
  214. package/src/models/orm/index.ts +2043 -0
  215. package/src/models/types.ts +71 -0
  216. package/src/router.ts +521 -0
  217. package/src/sqs-buffering.ts +806 -0
  218. package/src/stacks-integration.ts +527 -0
  219. package/src/tracking-script.ts +944 -0
  220. package/src/tracking.ts +27 -0
  221. package/src/types/analytics.ts +219 -0
  222. package/src/types/api.ts +75 -0
  223. package/src/types/bun-router.d.ts +15 -0
  224. package/src/types/dashboard.ts +62 -0
  225. package/src/types/index.ts +66 -0
  226. package/src/types/stx.d.ts +27 -0
  227. package/src/types/window.d.ts +101 -0
  228. package/src/types.ts +911 -0
  229. package/src/utils/cache.ts +148 -0
  230. package/src/utils/date.ts +118 -0
  231. package/src/utils/filters.ts +71 -0
  232. package/src/utils/geolocation.ts +323 -0
  233. package/src/utils/index.ts +9 -0
  234. package/src/utils/response.ts +180 -0
  235. package/src/utils/timezone-country.ts +242 -0
  236. package/src/utils/user-agent.ts +110 -0
  237. package/src/version.ts +7 -0
@@ -0,0 +1,371 @@
1
+ export {
2
+ // Types
3
+ type AggregatedStats,
4
+ type AggregationJobStatus,
5
+ type AggregationPeriod,
6
+ AggregationPipeline,
7
+ type AggregatorOptions,
8
+ AnalyticsAggregator,
9
+ AnalyticsKeyPatterns,
10
+ AnalyticsQueryAPI,
11
+ AnalyticsStore,
12
+ type AnalyticsStoreOptions,
13
+ type CampaignStats,
14
+ type Conversion,
15
+ type CustomEvent,
16
+ type DashboardData,
17
+ type DashboardSummary,
18
+ type DateRange,
19
+ type DeviceStats,
20
+ type DeviceType,
21
+ type EventStats,
22
+ generateTrackingScript,
23
+ type GeoStats,
24
+ type Goal,
25
+ GoalMatcher,
26
+ type GoalMatchResult,
27
+ type GoalPerformance,
28
+ type GoalStats,
29
+ type GoalType,
30
+ type PageStats,
31
+ type PageView,
32
+ type PipelineJobConfig,
33
+ type PipelineJobResult,
34
+ type QueryOptions,
35
+ type RealtimeData,
36
+ type RealtimeStats,
37
+ type ReferrerStats,
38
+ type Session,
39
+ type Site,
40
+ type SiteSettings,
41
+ type TimeSeriesPoint,
42
+ type TopItem,
43
+ type TrackingScriptOptions,
44
+ } from './Analytics';
45
+ // API Handlers
46
+ export {
47
+ AnalyticsAPI,
48
+ type AnalyticsAPIConfig,
49
+ type AnalyticsRequest,
50
+ type AnalyticsResponse,
51
+ type CollectPayload,
52
+ createBunRouter,
53
+ createLambdaHandler,
54
+ type HandlerContext,
55
+ type SessionStore,
56
+ } from './api';
57
+ // Configuration
58
+ export {
59
+ type AnalyticsConfig,
60
+ defaultAnalyticsConfig,
61
+ defaultConfig,
62
+ defaultGSIs,
63
+ defaultSingleTableConfig,
64
+ defineConfig,
65
+ getConfig,
66
+ getTableConfig,
67
+ getTtlForEntity,
68
+ resetConfig,
69
+ setConfig,
70
+ type UserAnalyticsConfig,
71
+ } from './config';
72
+ // Dashboard UI Components
73
+ export {
74
+ // Main dashboards
75
+ AnalyticsDashboard,
76
+ FullAnalyticsDashboard,
77
+
78
+ // Core components
79
+ StatCard,
80
+ RealtimeCounter,
81
+ ThemeSwitcher,
82
+
83
+ // Chart components
84
+ TimeSeriesChart,
85
+ DonutChart,
86
+ BarChart,
87
+ FunnelChart,
88
+ SparklineChart,
89
+ ProgressRing,
90
+ HeatmapChart,
91
+ MetricComparison,
92
+
93
+ // Breakdown components
94
+ DeviceBreakdown,
95
+ BrowserBreakdown,
96
+ OSBreakdown,
97
+ CampaignBreakdown,
98
+ CountryList,
99
+
100
+ // Data & interaction
101
+ DataTable,
102
+ TopList,
103
+ FilterBar,
104
+ DateRangePicker,
105
+ PageDetailCard,
106
+ GoalsPanel,
107
+
108
+ // Real-time & activity
109
+ LiveActivityFeed,
110
+ EngagementMetrics,
111
+ TrendIndicator,
112
+ AnimatedNumber,
113
+ MiniStats,
114
+ EmptyState,
115
+
116
+ // Alert
117
+ AlertCard,
118
+
119
+ // Composables
120
+ AnalyticsClient,
121
+ createAnalyticsComposable,
122
+ createRealtimePoller,
123
+ fetchDashboardData,
124
+ useAnalytics,
125
+
126
+ // Utilities
127
+ calculateAxisTicks,
128
+ calculateChange,
129
+ calculatePercentageChange,
130
+ formatCompact,
131
+ formatDate,
132
+ formatDateRange,
133
+ formatDuration,
134
+ formatNumber,
135
+ formatPercentage,
136
+ getDateRangeFromPreset,
137
+ getDateRangePreset,
138
+ dateRangePresets,
139
+
140
+ // Theme
141
+ defaultTheme,
142
+ darkTheme,
143
+
144
+ // Types
145
+ type AnalyticsApiConfig,
146
+ type ChartProps,
147
+ type DashboardTheme,
148
+ type DateRangePreset,
149
+ type RealtimeCounterProps,
150
+ type StatCardProps,
151
+ type TimeSeriesDataPoint,
152
+ type TopListProps,
153
+ } from './dashboard/index';
154
+ // DynamoDB Utilities
155
+ export {
156
+ buildGSI1PK,
157
+ buildPeriodSK,
158
+ buildPK,
159
+ buildSiteQuery,
160
+ buildSK,
161
+ buildTimeRangeQuery,
162
+ buildTimestampKey,
163
+ determinePeriod,
164
+ fromDynamoValue,
165
+ generateId,
166
+ generateSessionId,
167
+ getDailySalt,
168
+ getSharedDailySalt,
169
+ getPeriodStart,
170
+ hashVisitorId,
171
+ KeyPatterns,
172
+ marshal,
173
+ toDynamoValue,
174
+ unmarshal,
175
+ } from './dynamodb';
176
+ // Infrastructure (CloudFormation, CDK, Setup)
177
+ export {
178
+ type AnalyticsApiProps,
179
+ type AnalyticsTableProps,
180
+ checkTableStatus,
181
+ type CloudFormationConfig,
182
+ createAnalyticsTable,
183
+ createPitrMigration,
184
+ createStreamsMigration,
185
+ createTimeBasedGsiMigration,
186
+ type DynamoDBClientLike,
187
+ enableTtl,
188
+ generateAwsCliCommands,
189
+ generateCdkCode,
190
+ generateCdkTableCode,
191
+ generateCloudFormationJson,
192
+ generateCloudFormationTemplate,
193
+ generateCloudFormationYaml,
194
+ generateCreateTableInput,
195
+ generateSamTemplate,
196
+ generateSamYaml,
197
+ type MigrationResult,
198
+ type MigrationStep,
199
+ printSetupInstructions,
200
+ runMigrations,
201
+ type SetupConfig,
202
+ type SetupResult,
203
+ } from './infrastructure/index';
204
+ // Local Development
205
+ export {
206
+ defaultLocalConfig,
207
+ defaultSeedOptions,
208
+ generateAwsCliCommand,
209
+ generateDockerCompose,
210
+ generateLocalCreateTableInput,
211
+ generateSeedData,
212
+ type LocalDynamoDBConfig,
213
+ printLocalSetupInstructions,
214
+ type SeedDataOptions,
215
+ } from './local';
216
+ // Model Connector (Single-Table Design Integration)
217
+ export {
218
+ type AccessPattern,
219
+ analyticsModelRegistry,
220
+ type EntityDesign,
221
+ generateAccessPatternMatrix,
222
+ generateAnalyticsDesignDoc,
223
+ generateAnalyticsSingleTableDesign,
224
+ getAllAnalyticsModels,
225
+ getAnalyticsModel,
226
+ getAnalyticsModelNames,
227
+ type SingleTableDesign,
228
+ type StacksModelDefinition,
229
+ } from './model-connector';
230
+ // Stacks Model Definitions
231
+ export {
232
+ AggregatedStatsModel,
233
+ type AnalyticsModelName,
234
+ analyticsModels,
235
+ CampaignStatsModel,
236
+ ConversionModel,
237
+ CustomEventModel,
238
+ DeviceStatsModel,
239
+ EventStatsModel,
240
+ GeoStatsModel,
241
+ GoalModel,
242
+ GoalStatsModel,
243
+ PageStatsModel,
244
+ PageViewModel,
245
+ RealtimeStatsModel,
246
+ ReferrerStatsModel,
247
+ SessionModel,
248
+ SiteModel,
249
+ } from './models/index';
250
+ // Stacks Integration
251
+ export {
252
+ createAnalyticsDriver,
253
+ createAnalyticsMiddleware,
254
+ createDashboardActions,
255
+ createServerTrackingMiddleware,
256
+ type DynamoDBAnalyticsConfig,
257
+ DynamoDBAnalyticsDriver,
258
+ type StacksAnalyticsOptions,
259
+ } from './stacks-integration';
260
+ // Framework Integrations
261
+ export {
262
+ analyticsMiddleware,
263
+ type AnalyticsMiddlewareOptions,
264
+ type CloudflareEnv,
265
+ type CloudflareHandlerOptions,
266
+ createAnalyticsHandler,
267
+ createAnalyticsRoutes,
268
+ createD1Adapter,
269
+ mountAnalyticsRoutes,
270
+ type StorageAdapter,
271
+ } from './integrations/index';
272
+ // Batching Utilities
273
+ export {
274
+ type BatchItem,
275
+ type BatchQueueOptions,
276
+ type BatchWriteResult,
277
+ chunk,
278
+ createBatchProcessor,
279
+ type DynamoDBBatchClient,
280
+ EventBatchQueue,
281
+ parallelProcess,
282
+ withRetry,
283
+ } from './batching';
284
+ // SQS-Based Write Buffering (for high-throughput scenarios)
285
+ // Extends ts-cloud for infrastructure - see cloud.config.ts
286
+ export {
287
+ type AnalyticsEvent,
288
+ createAnalyticsProducer,
289
+ defaultSQSConfig,
290
+ EventBuffer,
291
+ type EventProcessor,
292
+ generateSQSResources,
293
+ getAllShardKeys,
294
+ getRandomShardedPartitionKey,
295
+ getShardedPartitionKey,
296
+ isSQSBufferingEnabled,
297
+ type ProcessResult,
298
+ type RealtimeUpdate,
299
+ type SQSClient,
300
+ type SQSConfig,
301
+ SQSEventConsumer,
302
+ SQSEventProducer,
303
+ type SQSLambdaMessage,
304
+ type SQSMessage,
305
+ type SQSRawMessage,
306
+ type SQSSendResult,
307
+ WriteCoalescer,
308
+ } from './sqs-buffering';
309
+ // Funnel Analysis
310
+ export {
311
+ calculateDropOffRate,
312
+ contentEngagementFunnel,
313
+ createFunnel,
314
+ ecommerceCheckoutFunnel,
315
+ formatFunnelReport,
316
+ type Funnel,
317
+ type FunnelAnalysis,
318
+ FunnelAnalyzer,
319
+ type FunnelStep,
320
+ type FunnelStepAnalysis,
321
+ type FunnelStepMatcher,
322
+ identifyDropOffPoints,
323
+ saasSignupFunnel,
324
+ type UserJourney,
325
+ } from './funnels';
326
+ // Tracking Script Generator
327
+ export {
328
+ generateFullTrackingScript,
329
+ generateGA4StyleScript,
330
+ generateInlineTrackingScript,
331
+ generateMinimalTrackingScript,
332
+ generateTrackingSnippet,
333
+ type TrackingScriptConfig,
334
+ } from './tracking-script';
335
+ // IP Geolocation & Location Services
336
+ export {
337
+ createIpApiProvider,
338
+ createMaxMindProvider,
339
+ extractCloudflareGeo,
340
+ extractVercelGeo,
341
+ formatGeoLocation,
342
+ formatGeoLocationShort,
343
+ type GeoLocation,
344
+ type GeoProvider,
345
+ GeolocationService,
346
+ type GeoServiceConfig,
347
+ getGeolocationService,
348
+ type IPGeoResult,
349
+ lookupFromHeaders,
350
+ lookupIP,
351
+ } from './geolocation';
352
+ // Reusable, backend-agnostic tracking + privacy primitives. These are the
353
+ // building blocks a self-hosted analytics app (e.g. ghostanalytics) composes:
354
+ // User-Agent parsing, bot filtering, cookieless visitor hashing, IP
355
+ // anonymization, CDN geo-header extraction, and referrer classification. They
356
+ // carry no DynamoDB/AWS coupling, so any storage backend can use them.
357
+ export {
358
+ getBrowserFamily,
359
+ isBot,
360
+ type ParsedUserAgent,
361
+ parseUserAgent,
362
+ } from './utils/user-agent';
363
+ export {
364
+ anonymizeIp,
365
+ countryCodeOf,
366
+ countryFlagEmoji,
367
+ getCountryFromHeaders,
368
+ getRegionFromHeaders,
369
+ isSpamReferrer,
370
+ parseReferrerSource,
371
+ } from './utils/geolocation';