@zoho_apptics/apptics-js-sdk 2.0.0-beta.1 → 2.0.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.
Files changed (183) hide show
  1. package/CHANGELOG.md +80 -16
  2. package/README.md +187 -100
  3. package/dist/apptics.esm.min.js +2 -2
  4. package/dist/apptics.esm.min.js.map +1 -1
  5. package/dist/apptics.min.js +2 -2
  6. package/dist/apptics.min.js.map +1 -1
  7. package/dist/chunks/lifecycle-C6m1W7jo.min.js +3 -0
  8. package/dist/chunks/lifecycle-C6m1W7jo.min.js.map +1 -0
  9. package/dist/chunks/send-CgUO82ne.min.js +3 -0
  10. package/dist/chunks/send-CgUO82ne.min.js.map +1 -0
  11. package/dist/cjs/core/attempts.js +1 -1
  12. package/dist/cjs/core/batch.js +1 -2
  13. package/dist/cjs/core/consent.d.ts +13 -3
  14. package/dist/cjs/core/consent.js +24 -10
  15. package/dist/cjs/core/constants.d.ts +22 -17
  16. package/dist/cjs/core/constants.js +22 -19
  17. package/dist/cjs/core/db.js +1 -1
  18. package/dist/cjs/core/debug.js +1 -1
  19. package/dist/cjs/core/env.d.ts +0 -3
  20. package/dist/cjs/core/env.js +1 -9
  21. package/dist/cjs/core/framework-id.d.ts +1 -1
  22. package/dist/cjs/core/framework-id.js +3 -3
  23. package/dist/cjs/core/guard.js +1 -1
  24. package/dist/cjs/core/hooks.d.ts +5 -0
  25. package/dist/cjs/core/hooks.js +2 -1
  26. package/dist/cjs/core/locks.js +1 -1
  27. package/dist/cjs/core/logger.js +1 -1
  28. package/dist/cjs/core/state.d.ts +6 -4
  29. package/dist/cjs/core/state.js +2 -4
  30. package/dist/cjs/core/storage.js +1 -4
  31. package/dist/cjs/core/stylesheet.js +1 -1
  32. package/dist/cjs/core/transport.js +13 -16
  33. package/dist/cjs/core/utils.js +1 -1
  34. package/dist/cjs/core/validate.js +1 -1
  35. package/dist/cjs/device/appversion.d.ts +10 -1
  36. package/dist/cjs/device/appversion.js +26 -3
  37. package/dist/cjs/device/index.d.ts +17 -2
  38. package/dist/cjs/device/index.js +195 -27
  39. package/dist/cjs/engagement/api-rules.js +1 -1
  40. package/dist/cjs/engagement/auto-api.js +1 -1
  41. package/dist/cjs/engagement/auto-screen.js +1 -1
  42. package/dist/cjs/engagement/defined-events.js +1 -1
  43. package/dist/cjs/engagement/send.js +7 -3
  44. package/dist/cjs/engagement/session.d.ts +17 -0
  45. package/dist/cjs/engagement/session.js +95 -4
  46. package/dist/cjs/engagement/track.d.ts +4 -4
  47. package/dist/cjs/engagement/track.js +15 -12
  48. package/dist/cjs/errors/send.js +2 -2
  49. package/dist/cjs/errors/track.d.ts +2 -1
  50. package/dist/cjs/errors/track.js +6 -4
  51. package/dist/cjs/feedback/controls.d.ts +6 -0
  52. package/dist/cjs/feedback/controls.js +74 -25
  53. package/dist/cjs/feedback/index.js +1 -1
  54. package/dist/cjs/feedback/logs.d.ts +3 -6
  55. package/dist/cjs/feedback/logs.js +8 -18
  56. package/dist/cjs/feedback/quartz.js +1 -1
  57. package/dist/cjs/feedback/send.d.ts +2 -2
  58. package/dist/cjs/feedback/send.js +4 -27
  59. package/dist/cjs/feedback/styles.js +2 -2
  60. package/dist/cjs/feedback/template.d.ts +1 -1
  61. package/dist/cjs/feedback/template.js +9 -1
  62. package/dist/cjs/feedback/ui.d.ts +7 -0
  63. package/dist/cjs/feedback/ui.js +160 -25
  64. package/dist/cjs/heatmap/send.d.ts +2 -0
  65. package/dist/cjs/heatmap/send.js +3 -5
  66. package/dist/cjs/heatmap/track.js +1 -1
  67. package/dist/cjs/index.d.ts +1 -2
  68. package/dist/cjs/index.js +54 -17
  69. package/dist/cjs/lifecycle.d.ts +13 -2
  70. package/dist/cjs/lifecycle.js +122 -54
  71. package/dist/cjs/remoteconfig/country.js +1 -1
  72. package/dist/cjs/remoteconfig/custom.js +1 -1
  73. package/dist/cjs/remoteconfig/evaluate.js +1 -1
  74. package/dist/cjs/remoteconfig/fetch.d.ts +17 -10
  75. package/dist/cjs/remoteconfig/fetch.js +126 -31
  76. package/dist/cjs/remoteconfig/index.d.ts +13 -4
  77. package/dist/cjs/remoteconfig/index.js +36 -20
  78. package/dist/cjs/remoteconfig/store.d.ts +15 -7
  79. package/dist/cjs/remoteconfig/store.js +68 -35
  80. package/dist/cjs/remoteconfig/tz-countries.js +1 -1
  81. package/dist/cjs/{core → remotelog}/callsite.d.ts +5 -4
  82. package/dist/cjs/{core → remotelog}/callsite.js +6 -5
  83. package/dist/cjs/remotelog/gate.js +1 -1
  84. package/dist/cjs/remotelog/logger.js +2 -2
  85. package/dist/cjs/remotelog/send.js +2 -2
  86. package/dist/cjs/remotelogger/index.js +1 -1
  87. package/dist/cjs/scheduler.d.ts +3 -1
  88. package/dist/cjs/scheduler.js +24 -21
  89. package/dist/cjs/types.d.ts +61 -16
  90. package/dist/cjs/user/index.js +6 -2
  91. package/dist/esm/core/attempts.js +1 -1
  92. package/dist/esm/core/batch.js +1 -2
  93. package/dist/esm/core/consent.d.ts +13 -3
  94. package/dist/esm/core/consent.js +24 -11
  95. package/dist/esm/core/constants.d.ts +22 -17
  96. package/dist/esm/core/constants.js +22 -19
  97. package/dist/esm/core/db.js +1 -1
  98. package/dist/esm/core/debug.js +1 -1
  99. package/dist/esm/core/env.d.ts +0 -3
  100. package/dist/esm/core/env.js +2 -9
  101. package/dist/esm/core/framework-id.d.ts +1 -1
  102. package/dist/esm/core/framework-id.js +3 -3
  103. package/dist/esm/core/guard.js +1 -1
  104. package/dist/esm/core/hooks.d.ts +5 -0
  105. package/dist/esm/core/hooks.js +2 -1
  106. package/dist/esm/core/locks.js +1 -1
  107. package/dist/esm/core/logger.js +1 -1
  108. package/dist/esm/core/state.d.ts +6 -4
  109. package/dist/esm/core/state.js +2 -4
  110. package/dist/esm/core/storage.js +1 -4
  111. package/dist/esm/core/stylesheet.js +1 -1
  112. package/dist/esm/core/transport.js +13 -16
  113. package/dist/esm/core/utils.js +1 -1
  114. package/dist/esm/core/validate.js +1 -1
  115. package/dist/esm/device/appversion.d.ts +10 -1
  116. package/dist/esm/device/appversion.js +26 -4
  117. package/dist/esm/device/index.d.ts +17 -2
  118. package/dist/esm/device/index.js +195 -30
  119. package/dist/esm/engagement/api-rules.js +1 -1
  120. package/dist/esm/engagement/auto-api.js +1 -1
  121. package/dist/esm/engagement/auto-screen.js +1 -1
  122. package/dist/esm/engagement/defined-events.js +1 -1
  123. package/dist/esm/engagement/send.js +7 -3
  124. package/dist/esm/engagement/session.d.ts +17 -0
  125. package/dist/esm/engagement/session.js +93 -5
  126. package/dist/esm/engagement/track.d.ts +4 -4
  127. package/dist/esm/engagement/track.js +16 -13
  128. package/dist/esm/errors/send.js +2 -2
  129. package/dist/esm/errors/track.d.ts +2 -1
  130. package/dist/esm/errors/track.js +6 -4
  131. package/dist/esm/feedback/controls.d.ts +6 -0
  132. package/dist/esm/feedback/controls.js +74 -26
  133. package/dist/esm/feedback/index.js +1 -1
  134. package/dist/esm/feedback/logs.d.ts +3 -6
  135. package/dist/esm/feedback/logs.js +8 -18
  136. package/dist/esm/feedback/quartz.js +1 -1
  137. package/dist/esm/feedback/send.d.ts +2 -2
  138. package/dist/esm/feedback/send.js +6 -29
  139. package/dist/esm/feedback/styles.js +2 -2
  140. package/dist/esm/feedback/template.d.ts +1 -1
  141. package/dist/esm/feedback/template.js +9 -1
  142. package/dist/esm/feedback/ui.d.ts +7 -0
  143. package/dist/esm/feedback/ui.js +161 -26
  144. package/dist/esm/heatmap/send.d.ts +2 -0
  145. package/dist/esm/heatmap/send.js +3 -5
  146. package/dist/esm/heatmap/track.js +1 -1
  147. package/dist/esm/index.d.ts +1 -2
  148. package/dist/esm/index.js +57 -20
  149. package/dist/esm/lifecycle.d.ts +13 -2
  150. package/dist/esm/lifecycle.js +126 -60
  151. package/dist/esm/remoteconfig/country.js +1 -1
  152. package/dist/esm/remoteconfig/custom.js +1 -1
  153. package/dist/esm/remoteconfig/evaluate.js +1 -1
  154. package/dist/esm/remoteconfig/fetch.d.ts +17 -10
  155. package/dist/esm/remoteconfig/fetch.js +127 -32
  156. package/dist/esm/remoteconfig/index.d.ts +13 -4
  157. package/dist/esm/remoteconfig/index.js +36 -20
  158. package/dist/esm/remoteconfig/store.d.ts +15 -7
  159. package/dist/esm/remoteconfig/store.js +68 -36
  160. package/dist/esm/remoteconfig/tz-countries.js +1 -1
  161. package/dist/esm/{core → remotelog}/callsite.d.ts +5 -4
  162. package/dist/esm/{core → remotelog}/callsite.js +6 -5
  163. package/dist/esm/remotelog/gate.js +1 -1
  164. package/dist/esm/remotelog/logger.js +2 -2
  165. package/dist/esm/remotelog/send.js +2 -2
  166. package/dist/esm/remotelogger/index.js +1 -1
  167. package/dist/esm/scheduler.d.ts +3 -1
  168. package/dist/esm/scheduler.js +25 -23
  169. package/dist/esm/types.d.ts +61 -16
  170. package/dist/esm/user/index.js +7 -3
  171. package/dist/feedback.esm.min.js +2 -2
  172. package/dist/feedback.esm.min.js.map +1 -1
  173. package/dist/remoteconfig.esm.min.js +3 -0
  174. package/dist/remoteconfig.esm.min.js.map +1 -0
  175. package/dist/remotelogger.esm.min.js +3 -0
  176. package/dist/remotelogger.esm.min.js.map +1 -0
  177. package/package.json +3 -2
  178. package/dist/chunks/lifecycle-VYr43KcB.min.js +0 -3
  179. package/dist/chunks/lifecycle-VYr43KcB.min.js.map +0 -1
  180. package/dist/cjs/auto-init.d.ts +0 -8
  181. package/dist/cjs/auto-init.js +0 -32
  182. package/dist/esm/auto-init.d.ts +0 -8
  183. package/dist/esm/auto-init.js +0 -29
package/CHANGELOG.md CHANGED
@@ -1,5 +1,69 @@
1
1
  # Change Log
2
2
 
3
+ # Apptics JS SDK 2.0.0-beta.2
4
+ Published under the `beta` npm tag; `latest` stays on 1.0.2. **Fixes heatmaps for npm apps**: with 2.0.0-beta.1 from npm, heatmap records were captured but never sent. **Breaking: an event's group is required.** **New: every automatic tracker switched the same way: a config key and a `set…Tracking()` call, and each kind of engagement follows its own switch in the Apptics console.**
5
+
6
+ ## Switching automatic tracking: a config key and a set…Tracking() call each
7
+ - New config keys: `track_error` (uncaught errors and unhandled rejections, on by default) and `track_click` (clicks on elements tagged `apeventaction`, on by default), beside `track_screen`, `track_api` and `track_heatmap`.
8
+ - New calls: `AppticsEvent.setClickTracking(enabled?)` and `AppticsScreen.setScreenTracking(enabled?)`.
9
+ - Renamed, so all five read the same: `AppticsApi.enableApiTracking` is `AppticsApi.setApiTracking`, `AppticsError.trackGlobalErrorHandler` is `AppticsError.setErrorTracking`, and `AppticsHeatmap.trackHeatmap` is `AppticsHeatmap.setHeatmapTracking`. The earlier names still work, with a console warning naming the call to use, once per page.
10
+ - Each call takes `true` or `false`, `true` when left out. The config key decides at start-up: a call made before `Apptics.init()` is replaced by it, and `Apptics.reset()` goes back to it. Before, `trackGlobalErrorHandler(false)` called before `Apptics.init()` stayed in force; now `track_error: false` is the way to start with it off.
11
+ - The calls the app makes itself (`addEvent`, `inScreen`, `trackError`, `startTrackApi`) record whichever way a switch is set.
12
+
13
+ ## Each kind of engagement follows its own module in getsdkconfig
14
+ - Events (module 5), API calls (6), screens (10) and sessions (11) are each switched by their own module. 2.0.0-beta.1 read only sessions (11) and switched all four with it, so turning off one kind in the Apptics console stopped them all, and turning off events alone did nothing.
15
+ - A kind that is off is not recorded, and the console says so in debug mode. Items of that kind already queued stay until it is on again, or until they expire (`batch_request_timeout`, 7 days).
16
+ - With sessions off and events or screens on, events and screens are still recorded, each with its session's start time; only the session itself is not sent.
17
+ - Errors follow `js_error` (module 15), the web SDK's own. 2.0.0-beta.1 read `crash` (13), which belongs to the native SDKs.
18
+ - A module the server does not mention is on, as before. Settings stored by an earlier build, with one `engagementtracking` flag, still switch all four.
19
+
20
+ ## An event's group is required
21
+ - Breaking: `AppticsEvent.addEvent(eventName, groupName, properties?)` needs a group. An event without one (left out, `''` or `null`) is not logged, and the console says so, debug or not: `AppticsEvent.addEvent: groupName is required for "<event>": addEvent(eventName, groupName, properties?)`, once per event name. 2.0.0-beta.1 filed it under `default`, a group the app never named.
22
+ - `addEvent(eventName, properties)`, with the properties in the group's place, is refused the same way.
23
+ - Click tracking: an element with `apeventaction` and no `apgroupaction` around it is not tracked, and the console says the group is missing. 2.0.0-beta.1 filed it under `default`.
24
+ - Defined events (`AppticsEvent.DefinedEvents.X`) bring their own group, as before. An invalid group is still refused, as before.
25
+ - TypeScript: `groupName` is required in `addEvent`'s types, so a call without it is a compile error.
26
+
27
+ ## Heatmaps are sent from npm builds
28
+ - Fix: with the npm package, heatmap records were captured and stored but never sent, by the flush timer or by `Apptics.flush()`. The sender was wired up by a module imported only for its side effect, and since the package's `sideEffects` names only the CDN bundle, app bundlers (Vite, webpack, Rollup) left it out. The CDN `<script>` build was not affected. A test now bundles the main entry the way an app does and checks that the sender is kept.
29
+
30
+ ## Sessions end when the user left
31
+ - When a tab goes inactive (hidden, minimised, or its window loses focus to another one), that moment is the session's `lastactivetime`. Focus moving into an iframe on the page does not count.
32
+ - Back within `inactiveduration` (30 minutes by default), the same session goes on.
33
+ - Not back by then, the session ends at `lastactivetime` and is sent straight away, rather than staying open until the user returns or the tab closes. Coming back later starts a new session.
34
+ - A tab closed while inactive ends its session at `lastactivetime`, not when it closed: the time it sat hidden is no longer session time. A tab closed while in use ends it then, as before.
35
+ - While another tab of the site is on the same session, a tab that goes inactive or closes only leaves it; the last one ends it.
36
+
37
+ ## The server's settings (getsdkconfig) are read on the server's schedule
38
+ - Once per page load: after `device/add` on a first visit, after `app/addversion` on a returning one (2.0.0-beta.1 made a returning visit wait for the first timer tick).
39
+ - Then at the time the answer's `next_check_after` gives, instead of every `getupdates_interval`. `getupdates_interval` is the wait only when an answer gives no time.
40
+ - Coming back to the tab asks again only once that time has passed; switching tabs used to ask every time.
41
+ - A device registered again during a page load (new device details, or a new SDK build) no longer asks a second time.
42
+
43
+ ## Remote config stays up to date by itself
44
+ - The first fetch of each page load sends `flagtime` 0 and gets the whole rule set, which replaces what was stored.
45
+ - After that the SDK asks every 3 minutes, and when the tab comes back after 15 seconds or more away, with `flagtime` set to the time of its last answered fetch. The server answers with only what changed, which is merged into the stored set by `paramid` and `conditionid`; parameters and conditions it does not resend are kept.
46
+ - The five-minute cache is removed: `fetchValue` and `fetchValues` answer from the values the polling keeps up to date, without a request of their own.
47
+ - **`coldFetch` is back**, as the last argument of `fetchValue(name, callback?, coldFetch?)` and `fetchValues(names?, callback?, coldFetch?)`, `false` by default; it may take the callback's place (`fetchValue(name, true)`, `fetchValues(true)`). `true` asks the server for the whole rule set now (`flagtime` 0), replaces the stored set with it and answers from it. At most three a minute; one past that answers from the values the page already has.
48
+
49
+ ## Apptics.flush() sends at most once every 15 seconds
50
+ - `Apptics.flush()` called by an app, or from the browser console, sends at most once every 15 seconds. A call sooner than that sends nothing and resolves at once; what is stored goes with the next send. The SDK's own sends (the flush timer, page hide and close, back online) are not held to it.
51
+
52
+ ## Stored data follows the app it belongs to
53
+ - A page that starts with a different `base_url`, `app_domain` or `auth_key` from the stored data's clears everything the SDK stored (settings and all five queues, unsent data included) before start-up, which then runs as on a first visit: `app/addversion`, `device/add` and the rest. 2.0.0-beta.1 compared only `base_url` and `app_domain`, and kept the heatmap, remote logger and feedback log queues.
54
+ - `app_version_info` keeps an 8-character fingerprint of `auth_key` (`zakhash`), not the key itself. Data stored by 2.0.0-beta.1, which has none, registers the app version again once and is not cleared.
55
+ - `Apptics.reset()` empties the heatmap, remote logger and feedback log queues too.
56
+
57
+ ## The CDN build is served from static.zohocdn.com
58
+ - `https://static.zohocdn.com/apptics-js-sdk/{version}/apptics.min.js`, with `apptics.esm.min.js`, `feedback.esm.min.js`, `chunks/` and the source maps in the same folder. Each release has a folder of its own.
59
+ - Remote config and the remote logger have module files of their own, as on npm: `remoteconfig.esm.min.js` (`AppticsRemoteConfig`) and `remotelogger.esm.min.js` (`AppticsLogger`), beside `apptics.esm.min.js` and `feedback.esm.min.js`. A page imports only the ones it uses, and they share one copy of the SDK.
60
+ - `npm run build` also writes that layout to `cdn/{version}/`, and the build server (`npm run build:cdn`, which registers the version first) zips it as `{version}/…` with `dist-meta.json`.
61
+
62
+ ## Fixes
63
+ - `device/add` sends `isanonrequired=false`. The web SDK has no anonymous mode, only the tracking statuses (with PII, without PII, none), which `devicestatus` carries; with the default status, usage tracking without PII, 2.0.0-beta.1 sent `true`.
64
+ - The device was registered again (`device/add`) on every page load when the server's answer carried no `anonymousid`, as sdk-apptics.zoho.in's does. A device with a `deviceid` counts as registered; `anonymousid` is optional.
65
+ - Start-up waits for stored data of another app to be cleared before calling `app/addversion`.
66
+
3
67
  # Apptics JS SDK 2.0.0-beta.1
4
68
  Published under the `beta` npm tag; `latest` stays on 1.0.2. **Breaking for 2.0.0-beta code**: the changes are listed below, each with what to use instead.
5
69
 
@@ -111,7 +175,7 @@ Breaking for 2.0.0-beta code: each call keeps its name and moves onto the object
111
175
  A rewrite of the web SDK in TypeScript, published on npm as ES modules, CommonJS and a minified browser build. Published under the `beta` npm tag; `latest` stays on 1.0.2. **`Apptics.init()` takes new config**: see "Migrating from 1.0.2 to 2.0.0-beta.1" in the README. Runs in Chrome 80+, Edge 80+, Firefox 74+ and Safari 14+.
112
176
 
113
177
  ## Initialization
114
- - **The Android SDK's names**: `Apptics.init(config)`, `AppticsEvents.addEvent`, `AppticsScreenTracker.inScreen` / `outScreen`, `AppticsApiTracker.startTrackApi` / `endTrackApi` / `configure`, `AppticsLogger.enable` / `disable` / `isEnabled` / `v` / `d` / `i` / `w` / `e`, `AppticsTrackError`, `AppticsSetUser`, and `AppticsRemoteConfig`. The `<script>` build defines them as globals too. 1.0.2's `apptics.init`, `apptics.trackEvent`, `apptics.trackScreen`, `apptics.trackError` and `apptics.setUser` are gone, so code calling them has to be renamed.
178
+ - **New names**: `Apptics.init(config)`, `AppticsEvents.addEvent`, `AppticsScreenTracker.inScreen` / `outScreen`, `AppticsApiTracker.startTrackApi` / `endTrackApi` / `configure`, `AppticsLogger.enable` / `disable` / `isEnabled` / `v` / `d` / `i` / `w` / `e`, `AppticsTrackError`, `AppticsSetUser`, and `AppticsRemoteConfig`. The `<script>` build defines them as globals too. 1.0.2's `apptics.init`, `apptics.trackEvent`, `apptics.trackScreen`, `apptics.trackError` and `apptics.setUser` are gone, so code calling them has to be renamed.
115
179
  - **New config**: `Apptics.init()` takes `serviceUrl`, `zak`, `identifier` and `appversion`, all required. The SDK gets `aaid`, the portal id and the project id from the server, so `aaid`, `zsoid` and `projectID` are no longer passed in. A missing key is named in a console warning and `Apptics.init()` returns `false`.
116
180
  - **`appversion` is required**: 1.0.2 defaulted it to `1.0`, which attributed every session, error and crash to a version that was never shipped.
117
181
  - **`appversion` takes a string or a number**: `'2.4.0'`, `'v2.4-build512'` or a build number such as `512`. It is sent as text: a string is trimmed, and a number keeps the digits JavaScript gives it (`1.10` is `'1.1'`), so pass a dotted version as a string. A blank value, or a snippet placeholder (`YOUR_APP_VERSION`, `YOUR_BUILD_OR_APP_VERSION`, `YOUR_APPVERSION`), is refused with a console warning and `Apptics.init()` returns `false`.
@@ -127,37 +191,37 @@ A rewrite of the web SDK in TypeScript, published on npm as ES modules, CommonJS
127
191
  - **License**: the Zoho Apptics JavaScript SDK license (see LICENSE) instead of MIT. It allows installing from npm or a CDN, bundling with your build tools and serving the SDK to your users as part of your web app.
128
192
 
129
193
  ## Events
130
- - **Defined events, as on Android**: `AppticsEvents.addEvent(DefinedEvents.AP_USER_LOGIN, props?)` logs Apptics' ready-made events under their own `AP_` groups.
194
+ - **Defined events**: `AppticsEvents.addEvent(DefinedEvents.AP_USER_LOGIN, props?)` logs Apptics' ready-made events under their own `AP_` groups.
131
195
  - **`ap_` / `AP_` is reserved**: an app's event, group or property key starting with it is not logged.
132
- - **An event with an invalid group is not logged**, as on Android, instead of being filed under `default`; an event with no group is still `default`.
196
+ - **An event with an invalid group is not logged**, instead of being filed under `default`; an event with no group is still `default`.
133
197
  - **Properties are judged one by one**: a bad key or an over-long value drops that property, and the event keeps the rest (it used to lose them all). Booleans are typed as Boolean and every number as Number (`1` and `0` were typed as Boolean); objects and arrays are sent as JSON text.
134
198
 
135
199
  ## Sessions
136
- - **`track_session: false`** turns automatic sessions off, as Android's `automaticSessionsTrackingStatus = false`; events and screens are still recorded.
200
+ - **`track_session: false`** turns automatic sessions off; events and screens are still recorded.
137
201
 
138
202
  ## Screen Tracking
139
- - **`trackScreen()` is renamed `AppticsScreenTracker.inScreen()`**, as in the Android SDK: same arguments, and it returns the view's id for `AppticsScreenTracker.outScreen(id)`. `trackScreen` no longer exists, so 1.0.2 code calling it has to be renamed.
140
- - **Screen views have a duration.** A view ends when the next screen starts, when the page is hidden (coming back starts a new view), or when its session ends. `AppticsScreenTracker.inScreen()` now returns the view's id, and `AppticsScreenTracker.outScreen(id)` ends it yourself, as Android's `outScreen`. Until now every view was recorded with no time spent.
203
+ - **`trackScreen()` is renamed `AppticsScreenTracker.inScreen()`**: same arguments, and it returns the view's id for `AppticsScreenTracker.outScreen(id)`. `trackScreen` no longer exists, so 1.0.2 code calling it has to be renamed.
204
+ - **Screen views have a duration.** A view ends when the next screen starts, when the page is hidden (coming back starts a new view), or when its session ends. `AppticsScreenTracker.inScreen()` now returns the view's id, and `AppticsScreenTracker.outScreen(id)` ends it yourself. Until now every view was recorded with no time spent.
141
205
  - **Automatic screen tracking, on by default**: the first page and every navigation (`pushState`, `replaceState`, back and forward, `#/` hash routes) are recorded as screens, named by the path without its query string. A `AppticsScreenTracker.inScreen()` from the router names a route your own way. A `AppticsScreenTracker.inScreen()` call within 300 ms of a navigation (from a router hook) replaces the automatic view, so the navigation counts once under the app's name; `track_screen: false` turns automatic tracking off.
142
206
  - **`setScreenName()` is removed.** Records are attributed to the screen `AppticsScreenTracker.inScreen()` or automatic tracking last named; heatmap records with neither get the page's name, made from its path the same way.
143
207
 
144
208
  ## Remote Logger
145
- - **`AppticsLogger`**: `AppticsLogger.v/d/i/w/e(tag, message, ...details)` sends the app's log lines to the Remote Logger page, as levels 1 to 5 in the Android and iOS order. Off until `AppticsLogger.enable()`; `AppticsLogger` in the `<script>` build. Each line carries the time it was logged and the function, file and line that logged it.
146
- - **Android's names too**: `AppticsLogger.v/d/i/w/e(tag, message)`, with the tag leading the message as `[tag]`, and `AppticsLogger.disable()`.
147
- - **`show_logs: true`** prints the app's lines to the browser console as well, as Android's `showLogs` does for Logcat.
148
- - **Offline storage is capped at 1 MB**, oldest lines dropped first, as on Android (instead of 200 lines).
209
+ - **`AppticsLogger`**: `AppticsLogger.v/d/i/w/e(tag, message, ...details)` sends the app's log lines to the Remote Logger page, as levels 1 to 5. Off until `AppticsLogger.enable()`; `AppticsLogger` in the `<script>` build. Each line carries the time it was logged and the function, file and line that logged it.
210
+ - **Tagged lines**: `AppticsLogger.v/d/i/w/e(tag, message)`, with the tag leading the message as `[tag]`, and `AppticsLogger.disable()`.
211
+ - **`show_logs: true`** prints the app's lines to the browser console as well.
212
+ - **Offline storage is capped at 1 MB**, oldest lines dropped first (instead of 200 lines).
149
213
  - **SDK diagnostics**: the SDK reports its own failures to the same page, tagged with the module it happened in. Off by default; `remote_log: true` turns it on, independently of `AppticsLogger`.
150
214
 
151
215
  ## API Tracking
152
- - **Path normalization, as on Android**: numeric ids, UUIDs and JWTs in a path become `*`, and the query string is removed, so calls group by endpoint (`/users/42/orders` → `/users/*/orders`).
153
- - **`AppticsApiTracker.configure(new ApiTrackingBuilder()...build())`** with Android's rules: `ignoreDomains`, `allowOnlyDomains`, `allowOnlyTLDs`, `ignoreTLDs`, `ignoreDomainPrefixes`, `ignoreDomainSuffixes`, `groupDomains`, `ignoreEndpoint`, `addPattern`, `preserveSegments`, `autoDetection`. They apply to every call.
154
- - **`AppticsApiTracker.startTrackApi(url, method)` / `AppticsApiTracker.endTrackApi(id, code)`** time and record a call, as on Android.
216
+ - **Path normalization**: numeric ids, UUIDs and JWTs in a path become `*`, and the query string is removed, so calls group by endpoint (`/users/42/orders` → `/users/*/orders`).
217
+ - **`AppticsApiTracker.configure(new ApiTrackingBuilder()...build())`** with rules: `ignoreDomains`, `allowOnlyDomains`, `allowOnlyTLDs`, `ignoreTLDs`, `ignoreDomainPrefixes`, `ignoreDomainSuffixes`, `groupDomains`, `ignoreEndpoint`, `addPattern`, `preserveSegments`, `autoDetection`. They apply to every call.
218
+ - **`AppticsApiTracker.startTrackApi(url, method)` / `AppticsApiTracker.endTrackApi(id, code)`** time and record a call.
155
219
  - **`track_api: true`** records every `fetch` and XHR call automatically (`enableApiTracking(on)` switches it later); a call is reported by hand with `AppticsApiTracker.startTrackApi` / `endTrackApi`. The SDK's own requests are never recorded. Host rules are set only through `AppticsApiTracker.configure`: the earlier `track_api_hosts` / `track_api_exclude_hosts` keys are gone, and `Apptics.init()` warns when it is given them.
156
220
 
157
221
  ## Remote Config
158
- - **`AppticsRemoteConfig`** from `@zoho_apptics/apptics-js-sdk/remote-config` (`AppticsRemoteConfig` in the `<script>` build): four calls, as on Android: `fetchValue(name)` and `fetchValues({ name: default })` read parameters, `setCustomConditionValue` and `setFallbackWithOfflineValue` (below). The rule set is stored and resolved on the device, and conditions on the user re-apply on their own after `AppticsSetUser`.
159
- - **`setCustomConditionValue(key, value)`**, as on Android: conditions on a custom criteria match this device's value. Kept across visits; works before `Apptics.init()`.
160
- - **`fetchValue(name)`** and **`fetchValues({ name: default })`**, as on Android: Promises, with an optional callback. A parameter the console doesn't have is `null`.
222
+ - **`AppticsRemoteConfig`** from `@zoho_apptics/apptics-js-sdk/remote-config` (`AppticsRemoteConfig` in the `<script>` build): four calls: `fetchValue(name)` and `fetchValues({ name: default })` read parameters, `setCustomConditionValue` and `setFallbackWithOfflineValue` (below). The rule set is stored and resolved on the device, and conditions on the user re-apply on their own after `AppticsSetUser`.
223
+ - **`setCustomConditionValue(key, value)`**: conditions on a custom criteria match this device's value. Kept across visits; works before `Apptics.init()`.
224
+ - **`fetchValue(name)`** and **`fetchValues({ name: default })`**: Promises, with an optional callback. A parameter the console doesn't have is `null`.
161
225
  - **Fetched on start-up**, so values are this session's without the app asking.
162
226
  - **A fetch from the last five minutes is reused**; `coldFetch` asks the server regardless, at most three times a minute.
163
227
  - **`setFallbackWithOfflineValue(false)`**: a failed fetch answers with `null` and defaults instead of the values fetched before (the default).