@appwrite.io/console 18.1.0 → 18.3.0-rc.1
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/README.md +1 -1
- package/dist/cjs/sdk.js +1876 -259
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +1872 -257
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +6294 -4654
- package/package.json +2 -2
- package/types/client.d.ts +4 -1
- package/types/enums/analytics-dimension.d.ts +24 -0
- package/types/enums/analytics-interval.d.ts +6 -0
- package/types/enums/build-runtime.d.ts +3 -0
- package/types/enums/o-auth-provider.d.ts +1 -0
- package/types/enums/project-key-scopes.d.ts +4 -1
- package/types/enums/project-o-auth-provider-id.d.ts +1 -0
- package/types/enums/proxy-rule-deployment-resource-type.d.ts +2 -1
- package/types/enums/query-suggestion-resource.d.ts +1 -0
- package/types/enums/runtime.d.ts +3 -0
- package/types/enums/usage-event-dimension.d.ts +9 -0
- package/types/enums/usage-event-metric.d.ts +4 -0
- package/types/enums/usage-gauge-metric.d.ts +1 -0
- package/types/index.d.ts +5 -0
- package/types/models.d.ts +285 -15
- package/types/services/account.d.ts +37 -10
- package/types/services/analytics-tracking.d.ts +211 -0
- package/types/services/analytics.d.ts +254 -0
- package/types/services/avatars.d.ts +33 -5
- package/types/services/console.d.ts +39 -3
- package/types/services/databases.d.ts +4 -1
- package/types/services/documents-db.d.ts +4 -1
- package/types/services/functions.d.ts +17 -2
- package/types/services/locale.d.ts +91 -7
- package/types/services/messaging.d.ts +40 -34
- package/types/services/notifications.d.ts +4 -1
- package/types/services/project.d.ts +29 -4
- package/types/services/proxy.d.ts +4 -0
- package/types/services/push.d.ts +26 -4
- package/types/services/sites.d.ts +21 -3
- package/types/services/tables-db.d.ts +4 -1
- package/types/services/teams.d.ts +2 -2
- package/types/services/usage.d.ts +4 -4
- package/types/services/vcs.d.ts +12 -3
- package/types/services/vectors-db.d.ts +4 -1
- package/types/services/webhooks.d.ts +2 -2
- package/types/service.d.ts +0 -11
|
@@ -1164,17 +1164,41 @@ export declare class Account {
|
|
|
1164
1164
|
/**
|
|
1165
1165
|
* Get the list of active sessions across different devices for the currently logged in user.
|
|
1166
1166
|
*
|
|
1167
|
+
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
1168
|
+
* @throws {AppwriteException}
|
|
1169
|
+
* @returns {Promise<Models.SessionList>}
|
|
1170
|
+
*/
|
|
1171
|
+
listSessions(params?: {
|
|
1172
|
+
total?: boolean;
|
|
1173
|
+
}): Promise<Models.SessionList>;
|
|
1174
|
+
/**
|
|
1175
|
+
* Get the list of active sessions across different devices for the currently logged in user.
|
|
1176
|
+
*
|
|
1177
|
+
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
1167
1178
|
* @throws {AppwriteException}
|
|
1168
1179
|
* @returns {Promise<Models.SessionList>}
|
|
1180
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1169
1181
|
*/
|
|
1170
|
-
listSessions(): Promise<Models.SessionList>;
|
|
1182
|
+
listSessions(total?: boolean): Promise<Models.SessionList>;
|
|
1171
1183
|
/**
|
|
1172
|
-
* Delete all sessions from the user account and remove any sessions cookies from the end client.
|
|
1184
|
+
* Delete all sessions from the user account and remove any sessions cookies from the end client. Pass `current` as false to keep the session making the request and sign out of every other session.
|
|
1173
1185
|
*
|
|
1186
|
+
* @param {boolean} params.current - Delete the current session too. Use false to sign out of every other session while staying signed in on this one.
|
|
1174
1187
|
* @throws {AppwriteException}
|
|
1175
1188
|
* @returns {Promise<{}>}
|
|
1176
1189
|
*/
|
|
1177
|
-
deleteSessions(
|
|
1190
|
+
deleteSessions(params?: {
|
|
1191
|
+
current?: boolean;
|
|
1192
|
+
}): Promise<{}>;
|
|
1193
|
+
/**
|
|
1194
|
+
* Delete all sessions from the user account and remove any sessions cookies from the end client. Pass `current` as false to keep the session making the request and sign out of every other session.
|
|
1195
|
+
*
|
|
1196
|
+
* @param {boolean} current - Delete the current session too. Use false to sign out of every other session while staying signed in on this one.
|
|
1197
|
+
* @throws {AppwriteException}
|
|
1198
|
+
* @returns {Promise<{}>}
|
|
1199
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1200
|
+
*/
|
|
1201
|
+
deleteSessions(current?: boolean): Promise<{}>;
|
|
1178
1202
|
/**
|
|
1179
1203
|
* Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail) or create an [OAuth2 session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
|
|
1180
1204
|
*
|
|
@@ -1183,31 +1207,34 @@ export declare class Account {
|
|
|
1183
1207
|
*/
|
|
1184
1208
|
createAnonymousSession(): Promise<Models.Session>;
|
|
1185
1209
|
/**
|
|
1186
|
-
* Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.
|
|
1210
|
+
* Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user. Use the optional `duration` parameter to create a shorter session, for example when the user doesn't choose "remember me". It must be at least 60 seconds and cannot exceed the project maximum session length.
|
|
1187
1211
|
*
|
|
1188
1212
|
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1189
1213
|
*
|
|
1190
1214
|
* @param {string} params.email - User email.
|
|
1191
1215
|
* @param {string} params.password - User password. Must be at least 8 chars.
|
|
1216
|
+
* @param {number} params.duration - Session length in seconds. Minimum is 60 seconds, and it cannot exceed the project maximum session length. Defaults to the project maximum session length.
|
|
1192
1217
|
* @throws {AppwriteException}
|
|
1193
1218
|
* @returns {Promise<Models.Session>}
|
|
1194
1219
|
*/
|
|
1195
1220
|
createEmailPasswordSession(params: {
|
|
1196
1221
|
email: string;
|
|
1197
1222
|
password: string;
|
|
1223
|
+
duration?: number;
|
|
1198
1224
|
}): Promise<Models.Session>;
|
|
1199
1225
|
/**
|
|
1200
|
-
* Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.
|
|
1226
|
+
* Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user. Use the optional `duration` parameter to create a shorter session, for example when the user doesn't choose "remember me". It must be at least 60 seconds and cannot exceed the project maximum session length.
|
|
1201
1227
|
*
|
|
1202
1228
|
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1203
1229
|
*
|
|
1204
1230
|
* @param {string} email - User email.
|
|
1205
1231
|
* @param {string} password - User password. Must be at least 8 chars.
|
|
1232
|
+
* @param {number} duration - Session length in seconds. Minimum is 60 seconds, and it cannot exceed the project maximum session length. Defaults to the project maximum session length.
|
|
1206
1233
|
* @throws {AppwriteException}
|
|
1207
1234
|
* @returns {Promise<Models.Session>}
|
|
1208
1235
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1209
1236
|
*/
|
|
1210
|
-
createEmailPasswordSession(email: string, password: string): Promise<Models.Session>;
|
|
1237
|
+
createEmailPasswordSession(email: string, password: string, duration?: number): Promise<Models.Session>;
|
|
1211
1238
|
/**
|
|
1212
1239
|
* Allow the user to login to their account using an OpenID Connect ID token obtained natively from the OAuth2 provider, for example via Google Credential Manager on Android or Sign in with Apple on iOS. No browser or redirect is involved: the ID token is verified against the provider's published signing keys and a session is created in a single request.
|
|
1213
1240
|
*
|
|
@@ -1295,7 +1322,7 @@ export declare class Account {
|
|
|
1295
1322
|
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1296
1323
|
*
|
|
1297
1324
|
*
|
|
1298
|
-
* @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, cloudflare, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, kakao, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, resend, salesforce, slack, spotify, stripe, tiktok, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom.
|
|
1325
|
+
* @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, cloudflare, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, kakao, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, resend, salesforce, slack, spotify, stripe, tiktok, tradeshift, tradeshiftBox, twitch, webflow, wordpress, x, yahoo, yammer, yandex, zoho, zoom.
|
|
1299
1326
|
* @param {string} params.success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
1300
1327
|
* @param {string} params.failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
1301
1328
|
* @param {string[]} params.scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
|
|
@@ -1316,7 +1343,7 @@ export declare class Account {
|
|
|
1316
1343
|
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1317
1344
|
*
|
|
1318
1345
|
*
|
|
1319
|
-
* @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, cloudflare, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, kakao, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, resend, salesforce, slack, spotify, stripe, tiktok, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom.
|
|
1346
|
+
* @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, cloudflare, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, kakao, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, resend, salesforce, slack, spotify, stripe, tiktok, tradeshift, tradeshiftBox, twitch, webflow, wordpress, x, yahoo, yammer, yandex, zoho, zoom.
|
|
1320
1347
|
* @param {string} success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
1321
1348
|
* @param {string} failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
1322
1349
|
* @param {string[]} scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
|
|
@@ -1574,7 +1601,7 @@ export declare class Account {
|
|
|
1574
1601
|
*
|
|
1575
1602
|
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1576
1603
|
*
|
|
1577
|
-
* @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, cloudflare, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, kakao, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, resend, salesforce, slack, spotify, stripe, tiktok, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom.
|
|
1604
|
+
* @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, cloudflare, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, kakao, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, resend, salesforce, slack, spotify, stripe, tiktok, tradeshift, tradeshiftBox, twitch, webflow, wordpress, x, yahoo, yammer, yandex, zoho, zoom.
|
|
1578
1605
|
* @param {string} params.success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
1579
1606
|
* @param {string} params.failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
1580
1607
|
* @param {string[]} params.scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
|
|
@@ -1596,7 +1623,7 @@ export declare class Account {
|
|
|
1596
1623
|
*
|
|
1597
1624
|
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1598
1625
|
*
|
|
1599
|
-
* @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, cloudflare, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, kakao, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, resend, salesforce, slack, spotify, stripe, tiktok, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom.
|
|
1626
|
+
* @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, cloudflare, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, kakao, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, resend, salesforce, slack, spotify, stripe, tiktok, tradeshift, tradeshiftBox, twitch, webflow, wordpress, x, yahoo, yammer, yandex, zoho, zoom.
|
|
1600
1627
|
* @param {string} success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
1601
1628
|
* @param {string} failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
1602
1629
|
* @param {string[]} scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics auto-tracking helpers.
|
|
3
|
+
*
|
|
4
|
+
* These are hand-written companions to the generated `Analytics` service.
|
|
5
|
+
* The generated service exposes `createEvent(params)` for arbitrary events;
|
|
6
|
+
* this module wires up common auto-tracking behaviours (pageviews, outbound
|
|
7
|
+
* links, downloads, scroll depth, active engagement) on top of it.
|
|
8
|
+
*
|
|
9
|
+
* The tracking helpers accept a plain event-emitter function so they do not
|
|
10
|
+
* hard-couple to the generated `Analytics` class. The emitter adapts this
|
|
11
|
+
* module's option shape to `createEvent`: `url` is required there, and `props`
|
|
12
|
+
* is a flat alternating key/value list rather than an object.
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* const analytics = new Analytics(client);
|
|
16
|
+
* const tracking = new AnalyticsTracking(
|
|
17
|
+
* (name, options) => analytics.createEvent({
|
|
18
|
+
* propertyId: options?.propertyId ?? '<PROPERTY_ID>',
|
|
19
|
+
* name,
|
|
20
|
+
* url: options?.url ?? window.location.href,
|
|
21
|
+
* referrer: options?.referrer,
|
|
22
|
+
* scrollDepth: options?.scrollDepth,
|
|
23
|
+
* engagementTime: options?.engagementTime,
|
|
24
|
+
* props: Object.entries(options?.props ?? {}).flatMap(
|
|
25
|
+
* ([key, value]) => [key, String(value)],
|
|
26
|
+
* ),
|
|
27
|
+
* }),
|
|
28
|
+
* { propertyId: '<PROPERTY_ID>' }
|
|
29
|
+
* );
|
|
30
|
+
* tracking.enableAllAutoTracking();
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* `propertyId` is optional: when set it is merged into the options of every
|
|
34
|
+
* emitted event, so an emitter that forwards `options.propertyId` (as above)
|
|
35
|
+
* picks it up instead of every caller hand-rolling it into the closure.
|
|
36
|
+
* Per-event `propertyId` always wins over the configured default.
|
|
37
|
+
*
|
|
38
|
+
* All helpers respect `navigator.doNotTrack === '1'` by default; opt out with
|
|
39
|
+
* `respectDoNotTrack: false` in the constructor options.
|
|
40
|
+
*
|
|
41
|
+
* Engagement time follows Plausible's model: rather than one total at unload,
|
|
42
|
+
* a delta is emitted at every natural checkpoint of the visit (tab hidden, SPA
|
|
43
|
+
* route change, unload). See `enableAutoEngagementTime` for details.
|
|
44
|
+
*
|
|
45
|
+
* Auto-emitted event names follow `snake_case` + lowercase (`pageview`,
|
|
46
|
+
* `outbound_link`, `file_download`, `screen_view`, etc.). Any prop keys use
|
|
47
|
+
* camelCase to match the endpoint's parameter naming. Callers can pass any
|
|
48
|
+
* custom event name; the auto-track methods only own the events they emit
|
|
49
|
+
* themselves.
|
|
50
|
+
*/
|
|
51
|
+
export type AnalyticsEventOptions = {
|
|
52
|
+
props?: Record<string, unknown>;
|
|
53
|
+
url?: string;
|
|
54
|
+
referrer?: string;
|
|
55
|
+
propertyId?: string;
|
|
56
|
+
scrollDepth?: number;
|
|
57
|
+
engagementTime?: number;
|
|
58
|
+
};
|
|
59
|
+
export type AnalyticsEventEmitter = (name: string, options?: AnalyticsEventOptions) => unknown;
|
|
60
|
+
export type AnalyticsTrackingOptions = {
|
|
61
|
+
/**
|
|
62
|
+
* When true (default) the tracker becomes a no-op if `navigator.doNotTrack`
|
|
63
|
+
* is set to `'1'`. Set to false to always fire regardless of the DNT signal.
|
|
64
|
+
*/
|
|
65
|
+
respectDoNotTrack?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Analytics property (or snippet) ID to attach to every emitted event.
|
|
68
|
+
* Optional — omit it when the emitter closure already supplies one. A
|
|
69
|
+
* `propertyId` passed on an individual event takes precedence.
|
|
70
|
+
*/
|
|
71
|
+
propertyId?: string;
|
|
72
|
+
};
|
|
73
|
+
export type OutboundTrackingOptions = {
|
|
74
|
+
/**
|
|
75
|
+
* When true, links pointing at the current host's subdomains are treated
|
|
76
|
+
* as outbound. Defaults to false (subdomains are same-origin for tracking).
|
|
77
|
+
*/
|
|
78
|
+
includeSubdomains?: boolean;
|
|
79
|
+
};
|
|
80
|
+
export type DownloadTrackingOptions = {
|
|
81
|
+
/**
|
|
82
|
+
* File extensions (without the leading dot) that mark an anchor as a
|
|
83
|
+
* download. Defaults cover the common set.
|
|
84
|
+
*/
|
|
85
|
+
extensions?: string[];
|
|
86
|
+
};
|
|
87
|
+
export declare class AnalyticsTracking {
|
|
88
|
+
private readonly emit;
|
|
89
|
+
private readonly respectDoNotTrack;
|
|
90
|
+
private readonly propertyId?;
|
|
91
|
+
private pageviewCleanups;
|
|
92
|
+
private outboundCleanup?;
|
|
93
|
+
private downloadCleanup?;
|
|
94
|
+
private scrollCleanups;
|
|
95
|
+
private engagementCleanups;
|
|
96
|
+
private currentPath?;
|
|
97
|
+
private maxScrollDepth;
|
|
98
|
+
private scrollTicking;
|
|
99
|
+
private lastScrollReport;
|
|
100
|
+
private engagementStart;
|
|
101
|
+
private engagementAccumulatedMs;
|
|
102
|
+
private engagementActive;
|
|
103
|
+
constructor(emit: AnalyticsEventEmitter, options?: AnalyticsTrackingOptions);
|
|
104
|
+
/**
|
|
105
|
+
* Enable the opinionated default auto-tracking set: pageviews, outbound
|
|
106
|
+
* links, scroll depth and active engagement time. Downloads must be opted
|
|
107
|
+
* into separately via `enableAutoDownloadTracking()` because the extension
|
|
108
|
+
* list is application-specific.
|
|
109
|
+
*/
|
|
110
|
+
enableAllAutoTracking(): void;
|
|
111
|
+
/**
|
|
112
|
+
* Track an event manually. Respects the DNT setting and swallows emitter
|
|
113
|
+
* exceptions so tracking failures never surface to the host page.
|
|
114
|
+
*/
|
|
115
|
+
track(name: string, options?: AnalyticsEventOptions): void;
|
|
116
|
+
/**
|
|
117
|
+
* Convenience wrapper for pageview-shaped events.
|
|
118
|
+
*/
|
|
119
|
+
pageview(url?: string, referrer?: string): void;
|
|
120
|
+
/**
|
|
121
|
+
* Enable SPA-aware pageview tracking. Fires an initial pageview on
|
|
122
|
+
* enable, then again on every `pushState`, `replaceState`, `popstate`
|
|
123
|
+
* or hashchange. Idempotent — repeat calls no-op.
|
|
124
|
+
*/
|
|
125
|
+
enableAutoPageviews(): void;
|
|
126
|
+
/**
|
|
127
|
+
* Disable auto-pageview tracking installed by `enableAutoPageviews`.
|
|
128
|
+
* Safe to call when auto-pageviews were never enabled.
|
|
129
|
+
*/
|
|
130
|
+
disableAutoPageviews(): void;
|
|
131
|
+
/**
|
|
132
|
+
* Enable click-based outbound link tracking. Detects anchor clicks that
|
|
133
|
+
* navigate to a different origin and fires an `outbound_link` event
|
|
134
|
+
* (with `hostname` and `href` props) before the browser navigates.
|
|
135
|
+
*/
|
|
136
|
+
enableAutoOutboundTracking(options?: OutboundTrackingOptions): void;
|
|
137
|
+
/**
|
|
138
|
+
* Disable outbound-link tracking installed by `enableAutoOutboundTracking`.
|
|
139
|
+
* Safe to call when auto-outbound was never enabled.
|
|
140
|
+
*/
|
|
141
|
+
disableAutoOutboundTracking(): void;
|
|
142
|
+
/**
|
|
143
|
+
* Enable click-based download tracking. Detects anchor clicks that point
|
|
144
|
+
* at a file whose extension appears in the configured list and fires a
|
|
145
|
+
* `file_download` event with `filename`, `extension` and `href` props.
|
|
146
|
+
*/
|
|
147
|
+
enableAutoDownloadTracking(options?: DownloadTrackingOptions): void;
|
|
148
|
+
/**
|
|
149
|
+
* Disable file-download tracking installed by `enableAutoDownloadTracking`.
|
|
150
|
+
* Safe to call when auto-download was never enabled.
|
|
151
|
+
*/
|
|
152
|
+
disableAutoDownloadTracking(): void;
|
|
153
|
+
/**
|
|
154
|
+
* Enable passive scroll-depth tracking. Records the maximum percent of the
|
|
155
|
+
* document scrolled and reports it on `beforeunload` and on SPA route
|
|
156
|
+
* changes. Uses a throttled passive listener so it is safe on hot paths.
|
|
157
|
+
*/
|
|
158
|
+
enableAutoScrollDepth(): void;
|
|
159
|
+
/**
|
|
160
|
+
* Disable scroll-depth tracking installed by `enableAutoScrollDepth`. Safe
|
|
161
|
+
* to call when auto-scroll-depth was never enabled. Any accumulated depth
|
|
162
|
+
* for the current page is dropped.
|
|
163
|
+
*/
|
|
164
|
+
disableAutoScrollDepth(): void;
|
|
165
|
+
/**
|
|
166
|
+
* Enable active engagement-time tracking. Counts time the tab is visible
|
|
167
|
+
* and uses `visibilitychange` to exclude background time.
|
|
168
|
+
*
|
|
169
|
+
* Delivery follows Plausible's model rather than a single total at the
|
|
170
|
+
* end of the visit: an `engagement_time` event is emitted at every natural
|
|
171
|
+
* checkpoint — the tab going hidden, an SPA route change, and finally
|
|
172
|
+
* `beforeunload`/`pagehide`. Unload is kept only as a best-effort last
|
|
173
|
+
* flush; it is the least reliable moment to send anything (browsers
|
|
174
|
+
* routinely cancel in-flight requests there, and `sendBeacon` cannot set
|
|
175
|
+
* the `X-Appwrite-Project` header the endpoint requires), so it must never
|
|
176
|
+
* be the only delivery.
|
|
177
|
+
*
|
|
178
|
+
* Each event carries a **delta** — the seconds accrued since the previous
|
|
179
|
+
* flush, not a running total — so the values are additive per session and
|
|
180
|
+
* a lost event costs only its own slice.
|
|
181
|
+
*
|
|
182
|
+
* There is deliberately no periodic ping. The cadence is driven by
|
|
183
|
+
* navigation and tab switches, so request volume tracks what the visitor
|
|
184
|
+
* actually does instead of multiplying with time on page.
|
|
185
|
+
*/
|
|
186
|
+
enableAutoEngagementTime(): void;
|
|
187
|
+
/**
|
|
188
|
+
* Disable engagement-time tracking installed by `enableAutoEngagementTime`.
|
|
189
|
+
* Safe to call when auto-engagement was never enabled. Any accumulated
|
|
190
|
+
* engagement time is dropped without being emitted.
|
|
191
|
+
*/
|
|
192
|
+
disableAutoEngagementTime(): void;
|
|
193
|
+
/**
|
|
194
|
+
* Merge the configured `propertyId` into an event's options. Returns the
|
|
195
|
+
* caller's object untouched when no default is configured (or the event
|
|
196
|
+
* already carries one), so emitters written against the pre-`propertyId`
|
|
197
|
+
* shape keep receiving exactly what they received before.
|
|
198
|
+
*/
|
|
199
|
+
private withPropertyId;
|
|
200
|
+
private canTrack;
|
|
201
|
+
private currentPageUrl;
|
|
202
|
+
private findAnchor;
|
|
203
|
+
private parseUrl;
|
|
204
|
+
private isExternal;
|
|
205
|
+
private rootDomain;
|
|
206
|
+
private computeScrollDepth;
|
|
207
|
+
private flushScrollDepth;
|
|
208
|
+
private startEngagement;
|
|
209
|
+
private pauseEngagement;
|
|
210
|
+
private flushEngagement;
|
|
211
|
+
}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { Client } from '../client';
|
|
2
|
+
import type { Models } from '../models';
|
|
3
|
+
import { AnalyticsInterval } from '../enums/analytics-interval';
|
|
4
|
+
import { AnalyticsDimension } from '../enums/analytics-dimension';
|
|
5
|
+
export declare class Analytics {
|
|
6
|
+
client: Client;
|
|
7
|
+
constructor(client: Client);
|
|
8
|
+
/**
|
|
9
|
+
* List analytics properties for the current project.
|
|
10
|
+
*
|
|
11
|
+
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, domain, timezone, enabled, public, snippetId
|
|
12
|
+
* @param {string} params.search - Search term to filter your list results. Matches the property ID, name and domain. Max length: 256 chars.
|
|
13
|
+
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
14
|
+
* @throws {AppwriteException}
|
|
15
|
+
* @returns {Promise<Models.AnalyticsPropertyList>}
|
|
16
|
+
*/
|
|
17
|
+
listProperties(params?: {
|
|
18
|
+
queries?: string[];
|
|
19
|
+
search?: string;
|
|
20
|
+
total?: boolean;
|
|
21
|
+
}): Promise<Models.AnalyticsPropertyList>;
|
|
22
|
+
/**
|
|
23
|
+
* List analytics properties for the current project.
|
|
24
|
+
*
|
|
25
|
+
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, domain, timezone, enabled, public, snippetId
|
|
26
|
+
* @param {string} search - Search term to filter your list results. Matches the property ID, name and domain. Max length: 256 chars.
|
|
27
|
+
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
28
|
+
* @throws {AppwriteException}
|
|
29
|
+
* @returns {Promise<Models.AnalyticsPropertyList>}
|
|
30
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
31
|
+
*/
|
|
32
|
+
listProperties(queries?: string[], search?: string, total?: boolean): Promise<Models.AnalyticsPropertyList>;
|
|
33
|
+
/**
|
|
34
|
+
* Create a new analytics property to track a website or application.
|
|
35
|
+
*
|
|
36
|
+
* @param {string} params.propertyId - Unique ID. Choose a custom ID or generate a random ID with `ID.unique()`. Max length is 36 chars.
|
|
37
|
+
* @param {string} params.name - Human-readable name for this property.
|
|
38
|
+
* @param {string} params.domain - Primary domain to track (e.g. example.com). Optional for native apps.
|
|
39
|
+
* @param {string} params.timezone - IANA timezone used for daily boundaries.
|
|
40
|
+
* @param {boolean} params.enabled - Whether tracking is enabled.
|
|
41
|
+
* @param {boolean} params.xpublic - Whether stats are publicly viewable.
|
|
42
|
+
* @param {string[]} params.allowedOrigins - Allowed origins for tracking. Use ["*"] to allow all.
|
|
43
|
+
* @throws {AppwriteException}
|
|
44
|
+
* @returns {Promise<Models.AnalyticsProperty>}
|
|
45
|
+
*/
|
|
46
|
+
createProperty(params: {
|
|
47
|
+
propertyId: string;
|
|
48
|
+
name: string;
|
|
49
|
+
domain?: string;
|
|
50
|
+
timezone?: string;
|
|
51
|
+
enabled?: boolean;
|
|
52
|
+
xpublic?: boolean;
|
|
53
|
+
allowedOrigins?: string[];
|
|
54
|
+
}): Promise<Models.AnalyticsProperty>;
|
|
55
|
+
/**
|
|
56
|
+
* Create a new analytics property to track a website or application.
|
|
57
|
+
*
|
|
58
|
+
* @param {string} propertyId - Unique ID. Choose a custom ID or generate a random ID with `ID.unique()`. Max length is 36 chars.
|
|
59
|
+
* @param {string} name - Human-readable name for this property.
|
|
60
|
+
* @param {string} domain - Primary domain to track (e.g. example.com). Optional for native apps.
|
|
61
|
+
* @param {string} timezone - IANA timezone used for daily boundaries.
|
|
62
|
+
* @param {boolean} enabled - Whether tracking is enabled.
|
|
63
|
+
* @param {boolean} xpublic - Whether stats are publicly viewable.
|
|
64
|
+
* @param {string[]} allowedOrigins - Allowed origins for tracking. Use ["*"] to allow all.
|
|
65
|
+
* @throws {AppwriteException}
|
|
66
|
+
* @returns {Promise<Models.AnalyticsProperty>}
|
|
67
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
68
|
+
*/
|
|
69
|
+
createProperty(propertyId: string, name: string, domain?: string, timezone?: string, enabled?: boolean, xpublic?: boolean, allowedOrigins?: string[]): Promise<Models.AnalyticsProperty>;
|
|
70
|
+
/**
|
|
71
|
+
* Get an analytics property by ID.
|
|
72
|
+
*
|
|
73
|
+
* @param {string} params.propertyId - Analytics property unique ID.
|
|
74
|
+
* @throws {AppwriteException}
|
|
75
|
+
* @returns {Promise<Models.AnalyticsProperty>}
|
|
76
|
+
*/
|
|
77
|
+
getProperty(params: {
|
|
78
|
+
propertyId: string;
|
|
79
|
+
}): Promise<Models.AnalyticsProperty>;
|
|
80
|
+
/**
|
|
81
|
+
* Get an analytics property by ID.
|
|
82
|
+
*
|
|
83
|
+
* @param {string} propertyId - Analytics property unique ID.
|
|
84
|
+
* @throws {AppwriteException}
|
|
85
|
+
* @returns {Promise<Models.AnalyticsProperty>}
|
|
86
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
87
|
+
*/
|
|
88
|
+
getProperty(propertyId: string): Promise<Models.AnalyticsProperty>;
|
|
89
|
+
/**
|
|
90
|
+
* Update an analytics property. Only the attributes you pass are changed; omitted attributes keep their current value.
|
|
91
|
+
*
|
|
92
|
+
* @param {string} params.propertyId - Analytics property unique ID.
|
|
93
|
+
* @param {string} params.name - Human-readable name for this property.
|
|
94
|
+
* @param {string} params.domain - Primary domain to track (e.g. example.com). Pass an empty string to clear it.
|
|
95
|
+
* @param {string} params.timezone - IANA timezone used for daily boundaries.
|
|
96
|
+
* @param {boolean} params.enabled - Whether tracking is enabled.
|
|
97
|
+
* @param {boolean} params.xpublic - Whether stats are publicly viewable.
|
|
98
|
+
* @param {string[]} params.allowedOrigins - Allowed origins for tracking. Use ["*"] to allow all.
|
|
99
|
+
* @throws {AppwriteException}
|
|
100
|
+
* @returns {Promise<Models.AnalyticsProperty>}
|
|
101
|
+
*/
|
|
102
|
+
updateProperty(params: {
|
|
103
|
+
propertyId: string;
|
|
104
|
+
name?: string;
|
|
105
|
+
domain?: string;
|
|
106
|
+
timezone?: string;
|
|
107
|
+
enabled?: boolean;
|
|
108
|
+
xpublic?: boolean;
|
|
109
|
+
allowedOrigins?: string[];
|
|
110
|
+
}): Promise<Models.AnalyticsProperty>;
|
|
111
|
+
/**
|
|
112
|
+
* Update an analytics property. Only the attributes you pass are changed; omitted attributes keep their current value.
|
|
113
|
+
*
|
|
114
|
+
* @param {string} propertyId - Analytics property unique ID.
|
|
115
|
+
* @param {string} name - Human-readable name for this property.
|
|
116
|
+
* @param {string} domain - Primary domain to track (e.g. example.com). Pass an empty string to clear it.
|
|
117
|
+
* @param {string} timezone - IANA timezone used for daily boundaries.
|
|
118
|
+
* @param {boolean} enabled - Whether tracking is enabled.
|
|
119
|
+
* @param {boolean} xpublic - Whether stats are publicly viewable.
|
|
120
|
+
* @param {string[]} allowedOrigins - Allowed origins for tracking. Use ["*"] to allow all.
|
|
121
|
+
* @throws {AppwriteException}
|
|
122
|
+
* @returns {Promise<Models.AnalyticsProperty>}
|
|
123
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
124
|
+
*/
|
|
125
|
+
updateProperty(propertyId: string, name?: string, domain?: string, timezone?: string, enabled?: boolean, xpublic?: boolean, allowedOrigins?: string[]): Promise<Models.AnalyticsProperty>;
|
|
126
|
+
/**
|
|
127
|
+
* Delete an analytics property along with every event and session collected for it. This cannot be undone.
|
|
128
|
+
*
|
|
129
|
+
* @param {string} params.propertyId - Analytics property unique ID.
|
|
130
|
+
* @throws {AppwriteException}
|
|
131
|
+
* @returns {Promise<{}>}
|
|
132
|
+
*/
|
|
133
|
+
deleteProperty(params: {
|
|
134
|
+
propertyId: string;
|
|
135
|
+
}): Promise<{}>;
|
|
136
|
+
/**
|
|
137
|
+
* Delete an analytics property along with every event and session collected for it. This cannot be undone.
|
|
138
|
+
*
|
|
139
|
+
* @param {string} propertyId - Analytics property unique ID.
|
|
140
|
+
* @throws {AppwriteException}
|
|
141
|
+
* @returns {Promise<{}>}
|
|
142
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
143
|
+
*/
|
|
144
|
+
deleteProperty(propertyId: string): Promise<{}>;
|
|
145
|
+
/**
|
|
146
|
+
* Send a tracking event from a browser, native app, or server-side SDK.
|
|
147
|
+
*
|
|
148
|
+
* @param {string} params.propertyId - Analytics property ID or snippet ID identifying the property.
|
|
149
|
+
* @param {string} params.name - Event name. "pageview" is just a conventional event name; events are not modeled specially.
|
|
150
|
+
* @param {string} params.url - Full page URL or screen identifier.
|
|
151
|
+
* @param {string} params.domain - Hostname (e.g. example.com).
|
|
152
|
+
* @param {string} params.referrer - Referrer URL.
|
|
153
|
+
* @param {number} params.screenWidth - Viewport width in CSS pixels.
|
|
154
|
+
* @param {string} params.sessionHash - Optional session hash (provided by SDK).
|
|
155
|
+
* @param {number} params.scrollDepth - Scroll depth percentage 0-100.
|
|
156
|
+
* @param {number} params.engagementTime - Engagement time in seconds, 0-4294967295.
|
|
157
|
+
* @param {string[]} params.props - Custom string properties as a flat key=value list (max 32 entries, alternating key,value).
|
|
158
|
+
* @param {string} params.userId - Override user ID. Requires API-key auth with analytics.write scope.
|
|
159
|
+
* @param {string} params.ip - Override IP address. Requires API-key auth with analytics.write scope.
|
|
160
|
+
* @param {string} params.userAgent - Override user agent. Requires API-key auth with analytics.write scope.
|
|
161
|
+
* @throws {AppwriteException}
|
|
162
|
+
* @returns {Promise<{}>}
|
|
163
|
+
*/
|
|
164
|
+
createEvent(params: {
|
|
165
|
+
propertyId: string;
|
|
166
|
+
name: string;
|
|
167
|
+
url: string;
|
|
168
|
+
domain?: string;
|
|
169
|
+
referrer?: string;
|
|
170
|
+
screenWidth?: number;
|
|
171
|
+
sessionHash?: string;
|
|
172
|
+
scrollDepth?: number;
|
|
173
|
+
engagementTime?: number;
|
|
174
|
+
props?: string[];
|
|
175
|
+
userId?: string;
|
|
176
|
+
ip?: string;
|
|
177
|
+
userAgent?: string;
|
|
178
|
+
}): Promise<{}>;
|
|
179
|
+
/**
|
|
180
|
+
* Send a tracking event from a browser, native app, or server-side SDK.
|
|
181
|
+
*
|
|
182
|
+
* @param {string} propertyId - Analytics property ID or snippet ID identifying the property.
|
|
183
|
+
* @param {string} name - Event name. "pageview" is just a conventional event name; events are not modeled specially.
|
|
184
|
+
* @param {string} url - Full page URL or screen identifier.
|
|
185
|
+
* @param {string} domain - Hostname (e.g. example.com).
|
|
186
|
+
* @param {string} referrer - Referrer URL.
|
|
187
|
+
* @param {number} screenWidth - Viewport width in CSS pixels.
|
|
188
|
+
* @param {string} sessionHash - Optional session hash (provided by SDK).
|
|
189
|
+
* @param {number} scrollDepth - Scroll depth percentage 0-100.
|
|
190
|
+
* @param {number} engagementTime - Engagement time in seconds, 0-4294967295.
|
|
191
|
+
* @param {string[]} props - Custom string properties as a flat key=value list (max 32 entries, alternating key,value).
|
|
192
|
+
* @param {string} userId - Override user ID. Requires API-key auth with analytics.write scope.
|
|
193
|
+
* @param {string} ip - Override IP address. Requires API-key auth with analytics.write scope.
|
|
194
|
+
* @param {string} userAgent - Override user agent. Requires API-key auth with analytics.write scope.
|
|
195
|
+
* @throws {AppwriteException}
|
|
196
|
+
* @returns {Promise<{}>}
|
|
197
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
198
|
+
*/
|
|
199
|
+
createEvent(propertyId: string, name: string, url: string, domain?: string, referrer?: string, screenWidth?: number, sessionHash?: string, scrollDepth?: number, engagementTime?: number, props?: string[], userId?: string, ip?: string, userAgent?: string): Promise<{}>;
|
|
200
|
+
/**
|
|
201
|
+
* Read analytics metrics (visitors, sessions, pageviews, events, bounceRate, …) for a property over a date range.
|
|
202
|
+
*
|
|
203
|
+
* **Three response shapes**, chosen by `dimensions[]` and `interval`:
|
|
204
|
+
* - Neither: one row aggregating the whole window, with `value` and `date` null. Only this shape carries `pageviews`, `visits`, `bounceRate`, `visitDuration`, `viewsPerVisit`, `scrollDepth` and `engagementTime`.
|
|
205
|
+
* - `dimensions[]`: one row per dimension value, ranked by visitors, with `value` set and `date` null.
|
|
206
|
+
* - `interval`: one row per time bucket in chronological order, with `date` set and `value` null.
|
|
207
|
+
*
|
|
208
|
+
* Combining `dimensions[]` with `interval` is not supported yet. `queries[]` filters the underlying events using standard Utopia query syntax.
|
|
209
|
+
*
|
|
210
|
+
* @param {string} params.propertyId - Analytics property unique ID.
|
|
211
|
+
* @param {string[]} params.queries - Up to 10 filter queries in Utopia syntax. Allowed attributes: country, region, city, browser, operatingSystem, device, screenSize, referrerSource, channel, utmSource, utmMedium, utmCampaign, utmContent, utmTerm, page, hostname, botName, botCategory, eventName. page, eventName are only accepted alongside `interval`, or with a breakdown on a dimension other than entryPage, exitPage. Allowed methods: equal, notEqual, contains, startsWith, endsWith. Example: `queries[]=equal("country", ["US"])`.
|
|
212
|
+
* @param {AnalyticsInterval} params.interval - Time bucket size. Omit (null) for a flat aggregate over the whole window. Allowed: 1h, 1d, 1w, 1m.
|
|
213
|
+
* @param {AnalyticsDimension[]} params.dimensions - Dimension to break the metrics down by. One at most for now; the parameter is a list so that cap can be raised without a breaking change. Allowed: country, region, city, browser, operatingSystem, device, screenSize, referrerSource, channel, utmSource, utmMedium, utmCampaign, utmContent, utmTerm, page, hostname, entryPage, exitPage, trafficType, botName, botCategory, eventName.
|
|
214
|
+
* @param {string} params.dateRange - Date range shorthand (e.g. 7d, 30d). Ignored for any bound you supply explicitly via startAt/endAt.
|
|
215
|
+
* @param {string} params.startAt - Explicit window start in ISO 8601. Defaults to endAt minus dateRange.
|
|
216
|
+
* @param {string} params.endAt - Explicit window end in ISO 8601. Defaults to the current time.
|
|
217
|
+
* @param {number} params.limit - Maximum number of ranked values to return.
|
|
218
|
+
* @throws {AppwriteException}
|
|
219
|
+
* @returns {Promise<Models.AnalyticsMetricList>}
|
|
220
|
+
*/
|
|
221
|
+
listMetrics(params: {
|
|
222
|
+
propertyId: string;
|
|
223
|
+
queries?: string[];
|
|
224
|
+
interval?: AnalyticsInterval;
|
|
225
|
+
dimensions?: AnalyticsDimension[];
|
|
226
|
+
dateRange?: string;
|
|
227
|
+
startAt?: string;
|
|
228
|
+
endAt?: string;
|
|
229
|
+
limit?: number;
|
|
230
|
+
}): Promise<Models.AnalyticsMetricList>;
|
|
231
|
+
/**
|
|
232
|
+
* Read analytics metrics (visitors, sessions, pageviews, events, bounceRate, …) for a property over a date range.
|
|
233
|
+
*
|
|
234
|
+
* **Three response shapes**, chosen by `dimensions[]` and `interval`:
|
|
235
|
+
* - Neither: one row aggregating the whole window, with `value` and `date` null. Only this shape carries `pageviews`, `visits`, `bounceRate`, `visitDuration`, `viewsPerVisit`, `scrollDepth` and `engagementTime`.
|
|
236
|
+
* - `dimensions[]`: one row per dimension value, ranked by visitors, with `value` set and `date` null.
|
|
237
|
+
* - `interval`: one row per time bucket in chronological order, with `date` set and `value` null.
|
|
238
|
+
*
|
|
239
|
+
* Combining `dimensions[]` with `interval` is not supported yet. `queries[]` filters the underlying events using standard Utopia query syntax.
|
|
240
|
+
*
|
|
241
|
+
* @param {string} propertyId - Analytics property unique ID.
|
|
242
|
+
* @param {string[]} queries - Up to 10 filter queries in Utopia syntax. Allowed attributes: country, region, city, browser, operatingSystem, device, screenSize, referrerSource, channel, utmSource, utmMedium, utmCampaign, utmContent, utmTerm, page, hostname, botName, botCategory, eventName. page, eventName are only accepted alongside `interval`, or with a breakdown on a dimension other than entryPage, exitPage. Allowed methods: equal, notEqual, contains, startsWith, endsWith. Example: `queries[]=equal("country", ["US"])`.
|
|
243
|
+
* @param {AnalyticsInterval} interval - Time bucket size. Omit (null) for a flat aggregate over the whole window. Allowed: 1h, 1d, 1w, 1m.
|
|
244
|
+
* @param {AnalyticsDimension[]} dimensions - Dimension to break the metrics down by. One at most for now; the parameter is a list so that cap can be raised without a breaking change. Allowed: country, region, city, browser, operatingSystem, device, screenSize, referrerSource, channel, utmSource, utmMedium, utmCampaign, utmContent, utmTerm, page, hostname, entryPage, exitPage, trafficType, botName, botCategory, eventName.
|
|
245
|
+
* @param {string} dateRange - Date range shorthand (e.g. 7d, 30d). Ignored for any bound you supply explicitly via startAt/endAt.
|
|
246
|
+
* @param {string} startAt - Explicit window start in ISO 8601. Defaults to endAt minus dateRange.
|
|
247
|
+
* @param {string} endAt - Explicit window end in ISO 8601. Defaults to the current time.
|
|
248
|
+
* @param {number} limit - Maximum number of ranked values to return.
|
|
249
|
+
* @throws {AppwriteException}
|
|
250
|
+
* @returns {Promise<Models.AnalyticsMetricList>}
|
|
251
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
252
|
+
*/
|
|
253
|
+
listMetrics(propertyId: string, queries?: string[], interval?: AnalyticsInterval, dimensions?: AnalyticsDimension[], dateRange?: string, startAt?: string, endAt?: string, limit?: number): Promise<Models.AnalyticsMetricList>;
|
|
254
|
+
}
|