Skip to content

feat: Console SDK update for version 18.3.0-rc.3 - #117

Closed
lohanidamodar wants to merge 1 commit into
mainfrom
dev
Closed

lohanidamodar wants to merge 1 commit into
mainfrom
dev

Conversation

@lohanidamodar

Copy link
Copy Markdown
Member

Generated with sdk-generator 5.5.4.

What's Changed

  • Added: Tracking helper (was AnalyticsTracking) — construct it with the Analytics service and call start() to turn on the built-in events
  • Changed: Tracking takes new Analytics(client) and a property id instead of an emitter callback; the adapter to createEvent now lives inside the SDK
  • Changed: enableAllAutoTracking() is now start()
  • Removed: AnalyticsEventEmitter; the option types are now TrackingEventOptions and TrackingOptions
const tracking = new Tracking(new Analytics(client), '<PROPERTY_ID>')
tracking.start()

Two deletions, both intended

  • src/services/assistant.ts — the Appwrite Assistant was retired upstream, so the generator no longer emits it. No remaining consumer: vibes dropped its Assistant import.
  • src/service.ts — the generator stopped emitting the Service base class; services call Client.flatten instead. It was never exported from index.ts.

Verification

npm run build produces cjs, esm and iife bundles.

Breaking only for the 18.3.0-rc.* prereleases that ship the old AnalyticsTracking; latest is unaffected.

@hansi-codes

hansi-codes Bot commented Oct 8, 2026

Copy link
Copy Markdown

🔵 Tier A · Mergeable after minor fixes

The PR has two minor tracking correctness issues; the remaining reviewed changes appear mergeable.

This update adds analytics property/event/metrics APIs and a browser Tracking helper, adds admin cache operations and push-notification interaction APIs, and refreshes generated models, enums, OAuth state support, and examples for the 18.3.0-rc.3 SDK. It also removes the retired Assistant and Service base class and updates services to use Client.flatten directly.

2 of 40 changed files were too large to include in full.

Verdict New comments Fixed Still open
💬 Commented 2 0 0

Note

Not approving while a bug finding is open: SPA pageviews keep the document's original referrer

Finding Where
🟡 SPA pageviews keep the document's original referrer src/services/analytics-tracking.ts:272
🟡 Outbound events can be canceled by link navigation src/services/analytics-tracking.ts:381
Fix with agent prompt
### Issue 1
src/services/analytics-tracking.ts:272
**SPA pageviews keep the document's original referrer**

On each SPA navigation this calls `pageview` without the previous route, so it falls back to `document.referrer`, which remains the document's initial referrer for the whole session. As a result, analytics records stale or empty referrers for subsequent in-app pageviews instead of the route the user came from.

### Issue 2
src/services/analytics-tracking.ts:381
**Outbound events can be canceled by link navigation**

`track()` starts a regular `fetch` and doesn't wait for it, while the click handler lets same-tab navigation proceed immediately. The browser may cancel the in-flight request when unloading the page, so outbound-link events are lost on normal navigations.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
📂 Walkthrough · 5
File Change
src/services/analytics.ts, src/services/analytics-tracking.ts, src/services/admin.ts Add analytics operations, browser auto-tracking, and admin cache APIs.
src/services/push.ts, src/services/storage.ts, src/services/account.ts, src/services/avatars.ts, src/services/functions.ts, src/services/organizations.ts, src/services/sites.ts Update push behavior, add OAuth state support, and remove Service inheritance/flatten calls.
src/models.ts, src/enums/**, src/index.ts, src/client.ts Refresh generated models, enums, exports, and SDK headers for the new release.
docs/examples/**, README.md, CHANGELOG.md, package.json Add and update SDK examples and release/version documentation.
src/service.ts, src/services/assistant.ts Remove the retired base class and Assistant service.

Reviewed b7da6d4 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@hansi-codes hansi-codes Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Tier A · See the inline comments. Summary

this.currentPath = nextPath;
this.flushScrollDepth(previous);
this.flushEngagement(previous);
this.pageview(nextPath);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SPA pageviews keep the document's original referrer

On each SPA navigation this calls pageview without the previous route, so it falls back to document.referrer, which remains the document's initial referrer for the whole session. As a result, analytics records stale or empty referrers for subsequent in-app pageviews instead of the route the user came from.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/services/analytics-tracking.ts
Line: 272

Comment:
**SPA pageviews keep the document's original referrer**

On each SPA navigation this calls `pageview` without the previous route, so it falls back to `document.referrer`, which remains the document's initial referrer for the whole session. As a result, analytics records stale or empty referrers for subsequent in-app pageviews instead of the route the user came from.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

🟡 Minor · bug · Reply if this doesn't apply.

if (!target || !this.isExternal(target, includeSubdomains)) {
return;
}
this.track('outbound_link', {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outbound events can be canceled by link navigation

track() starts a regular fetch and doesn't wait for it, while the click handler lets same-tab navigation proceed immediately. The browser may cancel the in-flight request when unloading the page, so outbound-link events are lost on normal navigations.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/services/analytics-tracking.ts
Line: 381

Comment:
**Outbound events can be canceled by link navigation**

`track()` starts a regular `fetch` and doesn't wait for it, while the click handler lets same-tab navigation proceed immediately. The browser may cancel the in-flight request when unloading the page, so outbound-link events are lost on normal navigations.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

🟡 Minor · bug · Reply if this doesn't apply.

@lohanidamodar

Copy link
Copy Markdown
Member Author

Closing without merging. Generating the console SDK from cloud main drops videos.ts, because the videos service lives in server-ce's preview/passkeys-videos-console-sdk branch, which cloud's branch of the same name pins — cloud main pins dev-main and so has no videos at all. vibes main imports Videos, so releasing this would break it.

A console RC needs generating from the videos branch, with cloud main merged in for the current analytics work, so the result is a superset of 18.3.0-rc.2 rather than a trade. Not blocking anything today: vibes pins 18.3.0-rc.2, which already has the analytics service it needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant