@pomeloanalytics/api 0.1.0-beta.0 → 0.1.0-beta.2
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/CHANGELOG.md +15 -0
- package/README.md +76 -19
- package/dist/generated/openapi.d.ts +33 -0
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.0-beta.2
|
|
4
|
+
|
|
5
|
+
- Add the product website, documentation links and relevant npm keywords.
|
|
6
|
+
- Clarify server-side setup, the first `me()` call and report examples.
|
|
7
|
+
- Keep the API implementation and generated contract types unchanged.
|
|
8
|
+
|
|
9
|
+
## 0.1.0-beta.1
|
|
10
|
+
|
|
11
|
+
- Sync the reviewed public contract for optional Acquisition `goalId` selection
|
|
12
|
+
with `include: 'details'`, transmitted as `goal_id` by the existing client.
|
|
13
|
+
- Add generated dimension impact types for sources, mediums and campaigns,
|
|
14
|
+
preserving API field names, conditional impact and complete response metadata.
|
|
15
|
+
- Verify goal selection and dimension impacts in typed, wire and isolated
|
|
16
|
+
tarball consumers; document candidate and published beta versions separately.
|
|
17
|
+
|
|
3
18
|
## 0.1.0-beta.0
|
|
4
19
|
|
|
5
20
|
- Prepare the server-side API client with injected fetch, request cancellation,
|
package/README.md
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
# @pomeloanalytics/api
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Read your Pomelo Analytics data from a Node.js backend. This TypeScript client
|
|
4
|
+
provides typed access to sites, reports, goals and API usage.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
[Website](https://www.pomeloanalytics.com/) ·
|
|
7
|
+
[Getting started](https://docs.pomeloanalytics.com/en/getting-started/) ·
|
|
8
|
+
[Démarrer en français](https://docs.pomeloanalytics.com/fr/getting-started/) ·
|
|
9
|
+
[API reference](https://docs.pomeloanalytics.com/en/api-reference/) ·
|
|
10
|
+
[Source and issues](https://github.com/pomeloanalytics/pomelo-js)
|
|
11
|
+
|
|
12
|
+
This package uses the `beta` prerelease line and is licensed under MIT. Check
|
|
13
|
+
the version shown by npm before installing. Browser pageviews and events are
|
|
14
|
+
collected by Pomelo's tracking script, installed through the getting-started guide.
|
|
6
15
|
|
|
7
16
|
Use Node.js 22.13+ on the Node 22 release line or Node.js 24. The package uses ESM
|
|
8
17
|
and has no runtime dependencies. CommonJS consumers on these supported Node
|
|
@@ -17,7 +26,16 @@ fetch is called.
|
|
|
17
26
|
npm install @pomeloanalytics/api@beta
|
|
18
27
|
```
|
|
19
28
|
|
|
20
|
-
|
|
29
|
+
Check the registry versions and dist-tags before choosing an installation:
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
npm view @pomeloanalytics/api dist-tags versions --json
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
A source checkout or local tarball may contain an unpublished candidate.
|
|
36
|
+
Registry metadata determines which versions are available from npm.
|
|
37
|
+
|
|
38
|
+
## First API call
|
|
21
39
|
|
|
22
40
|
```ts
|
|
23
41
|
import { createPomeloClient } from '@pomeloanalytics/api';
|
|
@@ -27,6 +45,20 @@ const token = process.env.POMELO_API_TOKEN;
|
|
|
27
45
|
if (!token) throw new Error('Configure POMELO_API_TOKEN on the server.');
|
|
28
46
|
const pomelo = createPomeloClient({ token });
|
|
29
47
|
|
|
48
|
+
// Check which account and permissions the token can access.
|
|
49
|
+
const { data: account } = await pomelo.me();
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Create a read token in the Pomelo dashboard as described in the getting-started
|
|
53
|
+
guide. Keep it in server configuration, outside source control and browser code.
|
|
54
|
+
API access depends on your plan and the token's permissions. The API enforces
|
|
55
|
+
collection-profile availability for each endpoint.
|
|
56
|
+
|
|
57
|
+
## Read metrics
|
|
58
|
+
|
|
59
|
+
Use a site ID returned by `pomelo.sites.list()` and explicit inclusive UTC dates:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
30
62
|
const result = await pomelo.metrics.timeseries({
|
|
31
63
|
siteId: 'site-test',
|
|
32
64
|
from: '2026-10-01',
|
|
@@ -109,6 +141,43 @@ deprecated alias for `full`. Actions accepts `summary`, `full`, and `details`
|
|
|
109
141
|
using its single response schema; summary leaves detail lists empty on the server.
|
|
110
142
|
Omitting `include` leaves the server's selection unchanged.
|
|
111
143
|
|
|
144
|
+
### Acquisition goal impact
|
|
145
|
+
|
|
146
|
+
The typed `goalId` option and source, medium and campaign impact fields require
|
|
147
|
+
`0.1.0-beta.1` or later. The optional `goalId` is used with `include: 'details'`
|
|
148
|
+
and sent as `goal_id`. It selects one configured goal belonging to the site. Omitting it
|
|
149
|
+
leaves the server's union of configured goals unchanged. An unknown goal or use
|
|
150
|
+
with another report variant is rejected by the server as `INVALID_PARAMS`.
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
const { data } = await pomelo.reports.acquisition({
|
|
154
|
+
siteId: 'site-test', from: '2026-10-01', to: '2026-10-24',
|
|
155
|
+
include: 'details', goalId: 'goal-test',
|
|
156
|
+
});
|
|
157
|
+
if ('dimensions' in data.current && data.current.impact) {
|
|
158
|
+
const { sources, mediums, campaigns } = data.current.impact;
|
|
159
|
+
// Items retain value, converted_sessions and session_conversion_rate.
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Impact is conditional on the server response and Extended data. It reports
|
|
164
|
+
distinct converted visits using first-pageview attribution; repeated goal
|
|
165
|
+
matches count once. Check availability as well as the optional impact object.
|
|
166
|
+
The SDK supplies no impact defaults or enrichment.
|
|
167
|
+
|
|
168
|
+
The API can also be read directly over HTTP without this package. From a server
|
|
169
|
+
shell with `POMELO_API_TOKEN` configured outside the source tree:
|
|
170
|
+
|
|
171
|
+
```sh
|
|
172
|
+
curl --get 'https://api.pomeloanalytics.com/v1/reports/acquisition' \
|
|
173
|
+
--header "Authorization: Bearer ${POMELO_API_TOKEN}" \
|
|
174
|
+
--data-urlencode 'site_id=site-test' \
|
|
175
|
+
--data-urlencode 'from=2026-10-01' \
|
|
176
|
+
--data-urlencode 'to=2026-10-24' \
|
|
177
|
+
--data-urlencode 'include=details' \
|
|
178
|
+
--data-urlencode 'goal_id=goal-test'
|
|
179
|
+
```
|
|
180
|
+
|
|
112
181
|
HTTP 200 on a mixed route means its strict-safe baseline succeeded. Check
|
|
113
182
|
`availability.sections` for sections that remain locked or only partially
|
|
114
183
|
available. Tenant-scoped reads use a stable opaque `tenantId`; the server checks
|
|
@@ -136,20 +205,8 @@ identifier takes precedence in response metadata.
|
|
|
136
205
|
Response bodies retain API field names, including `snake_case`, `availability`,
|
|
137
206
|
and metering metadata. There is no cache, aggregation, or fallback endpoint.
|
|
138
207
|
|
|
139
|
-
##
|
|
140
|
-
|
|
141
|
-
From the repository root, verify and create an installable local tarball:
|
|
142
|
-
|
|
143
|
-
```sh
|
|
144
|
-
npm ci
|
|
145
|
-
npm run check
|
|
146
|
-
mkdir -p .artifacts
|
|
147
|
-
npm pack --workspace @pomeloanalytics/api --ignore-scripts --pack-destination .artifacts
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
Install that tarball into another Node ESM project with
|
|
151
|
-
`npm install /path/to/pomeloanalytics-api-0.1.0-beta.0.tgz`.
|
|
208
|
+
## Help and contributions
|
|
152
209
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
210
|
+
- [Documentation](https://docs.pomeloanalytics.com/en/getting-started/) for setup and API access.
|
|
211
|
+
- [Issues](https://github.com/pomeloanalytics/pomelo-js/issues) for SDK bugs, without tokens or private report data.
|
|
212
|
+
- [Contributing](https://github.com/pomeloanalytics/pomelo-js/blob/main/CONTRIBUTING.md) for local checks, examples and release preparation.
|
|
@@ -344,6 +344,10 @@ export interface paths {
|
|
|
344
344
|
* `full` returns `current.by_channel` and top lists. `details` returns
|
|
345
345
|
* dimensions, landing pages and optional goal impact; it is a distinct
|
|
346
346
|
* Acquisition variant, not the Content alias for full.
|
|
347
|
+
* `goal_id` optionally selects one configured site goal for `details`
|
|
348
|
+
* impact. Impact reports distinct converted visits and rates by channel,
|
|
349
|
+
* landing page, source, medium and campaign using first-pageview
|
|
350
|
+
* attribution; omission uses the union of the site's configured goals.
|
|
347
351
|
*/
|
|
348
352
|
get: {
|
|
349
353
|
parameters: {
|
|
@@ -352,6 +356,13 @@ export interface paths {
|
|
|
352
356
|
compare?: components["parameters"]["CompareParam"];
|
|
353
357
|
/** @description Inclusive UTC start date (YYYY-MM-DD). Pass explicit from and to dates to bound the requested period. */
|
|
354
358
|
from?: components["parameters"]["FromDate"];
|
|
359
|
+
/**
|
|
360
|
+
* @description Acquisition `include=details` only. Selects one configured goal belonging
|
|
361
|
+
* to the requested site for conversion impact. Omission uses the union
|
|
362
|
+
* of all configured goals. An unknown goal or another report variant
|
|
363
|
+
* returns `INVALID_PARAMS` without charging usage.
|
|
364
|
+
*/
|
|
365
|
+
goal_id?: components["parameters"]["AcquisitionGoalId"];
|
|
355
366
|
/** @description Report depth for Acquisition and Actions. When report include selection is enabled, omission selects summary; otherwise the handler uses full even when include is supplied. No unconditional default is declared here. */
|
|
356
367
|
include?: components["parameters"]["ReportInclude"];
|
|
357
368
|
/** @description Number of rows returned by top lists for report endpoints. */
|
|
@@ -878,6 +889,11 @@ export interface components {
|
|
|
878
889
|
compare: components["schemas"]["UserApiAcquisitionDetailsCurrent"] | null;
|
|
879
890
|
current: components["schemas"]["UserApiAcquisitionDetailsCurrent"];
|
|
880
891
|
};
|
|
892
|
+
AcquisitionDimensionImpactItem: {
|
|
893
|
+
converted_sessions: number;
|
|
894
|
+
session_conversion_rate: number;
|
|
895
|
+
value: string;
|
|
896
|
+
};
|
|
881
897
|
AcquisitionDimensionItem: components["schemas"]["AcquisitionSummaryTotals"] & {
|
|
882
898
|
favicon_url?: string | null;
|
|
883
899
|
share: number;
|
|
@@ -886,7 +902,15 @@ export interface components {
|
|
|
886
902
|
AcquisitionFullReportResponse: components["schemas"]["UserApiAcquisitionEnvelope"] & {
|
|
887
903
|
meta: components["schemas"]["MeteredMeta"];
|
|
888
904
|
};
|
|
905
|
+
/**
|
|
906
|
+
* @description Extended-only goal impact. Each dimension comes from the visit's
|
|
907
|
+
* canonical first pageview in the requested scope. A converted visit
|
|
908
|
+
* matches at least one selected goal through an eligible Extended event;
|
|
909
|
+
* repeated matches count once. Rates divide converted visits by eligible
|
|
910
|
+
* Extended visits in the same dimension, period and traffic scope.
|
|
911
|
+
*/
|
|
889
912
|
AcquisitionImpact: {
|
|
913
|
+
campaigns: components["schemas"]["AcquisitionDimensionImpactItem"][];
|
|
890
914
|
channels: {
|
|
891
915
|
/** @enum {string} */
|
|
892
916
|
channel: "Direct" | "Search" | "Referral" | "Social" | "Email" | "Paid" | "Other";
|
|
@@ -898,6 +922,8 @@ export interface components {
|
|
|
898
922
|
path_canon: string | null;
|
|
899
923
|
session_conversion_rate: number;
|
|
900
924
|
}[];
|
|
925
|
+
mediums: components["schemas"]["AcquisitionDimensionImpactItem"][];
|
|
926
|
+
sources: components["schemas"]["AcquisitionDimensionImpactItem"][];
|
|
901
927
|
};
|
|
902
928
|
AcquisitionLandingPageSummaryItem: components["schemas"]["AcquisitionSummaryTotals"] & {
|
|
903
929
|
page_title?: string | null;
|
|
@@ -1814,6 +1840,13 @@ export interface components {
|
|
|
1814
1840
|
};
|
|
1815
1841
|
};
|
|
1816
1842
|
parameters: {
|
|
1843
|
+
/**
|
|
1844
|
+
* @description Acquisition `include=details` only. Selects one configured goal belonging
|
|
1845
|
+
* to the requested site for conversion impact. Omission uses the union
|
|
1846
|
+
* of all configured goals. An unknown goal or another report variant
|
|
1847
|
+
* returns `INVALID_PARAMS` without charging usage.
|
|
1848
|
+
*/
|
|
1849
|
+
AcquisitionGoalId: string;
|
|
1817
1850
|
/** @description Filter action reports by normalized action family. */
|
|
1818
1851
|
ActionFamily: "goals" | "forms" | "outbound" | "downloads" | "errors" | "custom" | "instrumentation";
|
|
1819
1852
|
/** @description Filter action reports by normalized action key. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pomeloanalytics/api",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0-beta.2",
|
|
4
|
+
"description": "TypeScript client for reading Pomelo Analytics reports, sites and goals from Node.js servers.",
|
|
5
|
+
"homepage": "https://www.pomeloanalytics.com/",
|
|
6
|
+
"keywords": ["pomelo", "analytics", "web-analytics", "typescript", "nodejs", "sdk", "api-client"],
|
|
5
7
|
"type": "module",
|
|
6
8
|
"license": "MIT",
|
|
7
9
|
"repository": {
|