@medusajs/analytics-local 2.22.0-snapshot-20261020204851 → 2.22.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 (3) hide show
  1. package/AGENTS.md +45 -0
  2. package/README.md +87 -0
  3. package/package.json +7 -3
package/AGENTS.md ADDED
@@ -0,0 +1,45 @@
1
+ # @medusajs/analytics-local
2
+
3
+ Analytics Module provider that writes `track`/`identify` calls to the Medusa logger at `debug` level instead of sending them anywhere. Use it in development; swap for `@medusajs/analytics-posthog` (or a custom provider) in production.
4
+
5
+ ## Using this package
6
+
7
+ The Analytics Module isn't registered by default. Register it with this provider in `medusa-config.ts`:
8
+
9
+ ```ts
10
+ module.exports = defineConfig({
11
+ modules: [
12
+ {
13
+ resolve: "@medusajs/medusa/analytics",
14
+ options: {
15
+ providers: [
16
+ {
17
+ resolve: "@medusajs/medusa/analytics-local",
18
+ id: "local",
19
+ },
20
+ ],
21
+ },
22
+ },
23
+ ],
24
+ })
25
+ ```
26
+
27
+ - No options (`LocalAnalyticsServiceOptions` is an empty interface).
28
+ - Resolve the module with `Modules.ANALYTICS` and call `track()` / `identify()` on it; this provider is never called directly.
29
+ - Docs: https://docs.medusajs.com/resources/infrastructure-modules/analytics/local.md
30
+ - Build a custom analytics provider: https://docs.medusajs.com/resources/references/analytics/provider.md
31
+
32
+ ## Architecture
33
+
34
+ - `src/services/local-analytics.ts`: `LocalAnalyticsService extends AbstractAnalyticsProviderService` (from `@medusajs/framework/utils`), `static identifier = "analytics-local"`. Registration key is `{identifier}_{id}` (e.g. `analytics-local_local`).
35
+ - Implements only `track(data)` and `identify(data)`. `shutdown()` is optional on providers and not implemented here.
36
+ - Smallest reference implementation for a custom analytics provider.
37
+
38
+ ## Development
39
+
40
+ - `yarn build`, `yarn test` (no tests in this package; `--passWithNoTests`).
41
+
42
+ ## Gotchas
43
+
44
+ - Output is logged with `logger.debug`, so nothing appears unless the log level includes debug (e.g. `LOG_LEVEL=debug`).
45
+ - The Analytics Module throws `Analytics module should be initialized with exactly one provider` if zero or more than one provider is registered.
package/README.md CHANGED
@@ -0,0 +1,87 @@
1
+ <p align="center">
2
+ <a href="https://www.medusajs.com">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/59018053/229103275-b5e482bb-4601-46e6-8142-244f531cebdb.svg">
5
+ <source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/59018053/229103726-e5b529a3-9b3f-4970-8a1f-c6af37f087bf.svg">
6
+ <img alt="Medusa logo" src="https://user-images.githubusercontent.com/59018053/229103726-e5b529a3-9b3f-4970-8a1f-c6af37f087bf.svg">
7
+ </picture>
8
+ </a>
9
+ </p>
10
+ <h1 align="center">
11
+ @medusajs/analytics-local
12
+ </h1>
13
+
14
+ <h4 align="center">
15
+ <a href="https://docs.medusajs.com">Documentation</a> |
16
+ <a href="https://www.medusajs.com">Website</a>
17
+ </h4>
18
+
19
+ <p align="center">
20
+ Building blocks for digital commerce
21
+ </p>
22
+ <p align="center">
23
+ <a href="https://github.com/medusajs/medusa/blob/develop/LICENSE">
24
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="Medusa is released under the MIT license." />
25
+ </a>
26
+ <a href="https://github.com/medusajs/medusa/blob/develop/CONTRIBUTING.md">
27
+ <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat" alt="PRs welcome!" />
28
+ </a>
29
+ <a href="https://discord.gg/xpCwq3Kfn8">
30
+ <img src="https://img.shields.io/badge/chat-on%20discord-7289DA.svg" alt="Discord Chat" />
31
+ </a>
32
+ <a href="https://twitter.com/intent/follow?screen_name=medusajs">
33
+ <img src="https://img.shields.io/twitter/follow/medusajs.svg?label=Follow%20@medusajs" alt="Follow @medusajs" />
34
+ </a>
35
+ </p>
36
+
37
+ Local Analytics Module Provider for Medusa: logs analytics `track` and `identify` calls to the Medusa logger at debug level instead of sending them to a third-party service. Use it in development to see which analytics events your application emits. It ships with `@medusajs/medusa` and is registered through the `@medusajs/medusa/analytics-local` path.
38
+
39
+ ## At a glance
40
+
41
+ | | |
42
+ | --- | --- |
43
+ | Package | `@medusajs/analytics-local` |
44
+ | Type | Module Provider (Analytics Module) |
45
+ | Provider ID | `analytics-local` |
46
+ | Registered by default | No |
47
+ | Import from | `@medusajs/medusa/analytics-local` |
48
+
49
+ ## Installation
50
+
51
+ No installation needed. The provider is a dependency of `@medusajs/medusa`.
52
+
53
+ ## Usage
54
+
55
+ Register the provider in the Analytics Module's `providers` array in `medusa-config.ts`. The Analytics Module accepts exactly one provider.
56
+
57
+ ```ts
58
+ import { defineConfig } from "@medusajs/framework/utils"
59
+
60
+ module.exports = defineConfig({
61
+ // ...
62
+ modules: [
63
+ {
64
+ resolve: "@medusajs/medusa/analytics",
65
+ options: {
66
+ providers: [
67
+ {
68
+ resolve: "@medusajs/medusa/analytics-local",
69
+ id: "local",
70
+ },
71
+ ],
72
+ },
73
+ },
74
+ ],
75
+ })
76
+ ```
77
+
78
+ Events are logged at the `debug` level, so set your log level accordingly to see them.
79
+
80
+ ## Configuration
81
+
82
+ The provider has no options.
83
+
84
+ ## Resources
85
+
86
+ - [Local Analytics Module Provider](https://docs.medusajs.com/resources/infrastructure-modules/analytics/local)
87
+ - [Analytics Module](https://docs.medusajs.com/resources/infrastructure-modules/analytics)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/analytics-local",
3
- "version": "2.22.0-snapshot-20261020204851",
3
+ "version": "2.22.0",
4
4
  "description": "Local analytics provider for Medusa",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -13,10 +13,14 @@
13
13
  },
14
14
  "files": [
15
15
  "dist",
16
+ "AGENTS.md",
16
17
  "!dist/**/__tests__",
17
18
  "!dist/**/__mocks__",
18
19
  "!dist/**/__fixtures__"
19
20
  ],
21
+ "llms": "https://docs.medusajs.com/llms.txt",
22
+ "llmsFull": "https://docs.medusajs.com/llms-full.txt",
23
+ "mcpServer": "https://docs.medusajs.com/mcp",
20
24
  "engines": {
21
25
  "node": ">=22.22.0"
22
26
  },
@@ -28,10 +32,10 @@
28
32
  "watch": "yarn run -T tsc --watch"
29
33
  },
30
34
  "devDependencies": {
31
- "@medusajs/framework": "2.22.0-snapshot-20261020204851"
35
+ "@medusajs/framework": "2.22.0"
32
36
  },
33
37
  "peerDependencies": {
34
- "@medusajs/framework": "2.22.0-snapshot-20261020204851"
38
+ "@medusajs/framework": "2.22.0"
35
39
  },
36
40
  "keywords": [
37
41
  "medusa-plugin",