-
Notifications
You must be signed in to change notification settings - Fork 476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Analytics] Unify client analytics #2224
Conversation
🦋 Changeset detectedLatest commit: 3c414a9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
(globalThis as any).X_SDK_NAME = "UnitySDK"; | ||
(globalThis as any).X_SDK_PLATFORM = "unity"; | ||
(globalThis as any).X_SDK_VERSION = "4.5.1"; | ||
(globalThis as any).X_SDK_OS = "webgl"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here we should call detectOS()
- 'win' / 'mac' / etc
need to add detect-browser
as a dependency and import it here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 110dd8f
…dev/js into firekeeper/client-analytics-v2
packages/sdk/src/evm/core/sdk.ts
Outdated
? "browser" | ||
: "node"; | ||
(globalThis as any).X_SDK_VERSION = pkg.version; | ||
(globalThis as any).X_SDK_OS = getOperatingSystem(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm i wonder if we should just do these as fallbacks at the callsite where we pass the headers instead. Bit worried about the order of operations here
headers["x-sdk-version"] = (globalThis as any).X_SDK_VERSION; | ||
headers["x-sdk-name"] = (globalThis as any).X_SDK_NAME; | ||
headers["x-sdk-platform"] = (globalThis as any).X_SDK_PLATFORM; | ||
headers["x-sdk-os"] = (globalThis as any).X_SDK_OS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for storage, would just add the fallbacks inline here
headers["x-sdk-version"] = (globalThis as any).X_SDK_VERSION; | ||
headers["x-sdk-name"] = (globalThis as any).X_SDK_NAME; | ||
headers["x-sdk-platform"] = (globalThis as any).X_SDK_PLATFORM; | ||
headers["x-sdk-os"] = (globalThis as any).X_SDK_OS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, fallback inline, otherwise its too dependent on who sets up their globals first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We desperately need a utils package to share between all packages
"x-sdk-version": (globalThis as any).X_SDK_VERSION, | ||
"x-sdk-name": (globalThis as any).X_SDK_NAME, | ||
"x-sdk-platform": (globalThis as any).X_SDK_PLATFORM, | ||
"x-sdk-os": (globalThis as any).X_SDK_OS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice ty
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #2224 +/- ##
==========================================
- Coverage 67.56% 67.09% -0.48%
==========================================
Files 291 294 +3
Lines 11042 11162 +120
Branches 1519 1542 +23
==========================================
+ Hits 7461 7489 +28
- Misses 2954 3043 +89
- Partials 627 630 +3 ☔ View full report in Codecov by Sentry. |
headers["x-sdk-version"] = (globalThis as any).X_SDK_VERSION; | ||
headers["x-sdk-name"] = (globalThis as any).X_SDK_NAME; | ||
headers["x-sdk-platform"] = (globalThis as any).X_SDK_PLATFORM; | ||
headers["x-sdk-os"] = (globalThis as any).X_SDK_OS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one also needs to fallback :/ could be using wallet SDK standalone
[X_SDK_NAME_HEADER]: (globalThis as any).X_SDK_NAME, | ||
[X_SDK_OS_HEADER]: (globalThis as any).X_SDK_OS, | ||
[X_SDK_PLATFORM_HEADER]: (globalThis as any).X_SDK_PLATFORM, | ||
[X_SDK_VERSION_HEADER]: (globalThis as any).X_SDK_VERSION, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure this is ok? not sure if the values are set (in the provider) at the time of importing this file
[X_SDK_NAME_HEADER]: (globalThis as any).X_SDK_NAME, | ||
[X_SDK_OS_HEADER]: (globalThis as any).X_SDK_OS, | ||
[X_SDK_PLATFORM_HEADER]: (globalThis as any).X_SDK_PLATFORM, | ||
[X_SDK_VERSION_HEADER]: (globalThis as any).X_SDK_VERSION, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
/release-pr |
@@ -18,6 +18,7 @@ | |||
"@thirdweb-dev/sdk": "workspace:*", | |||
"@thirdweb-dev/storage": "workspace:*", | |||
"@thirdweb-dev/wallets": "workspace:*", | |||
"detect-browser": "^5.3.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chose to add the code since it's been unmaintained for 2 years now. Although copy pasting it in all sdks feels wrong. We need a utils package.
@@ -143,7 +143,7 @@ class ThirdwebBridge implements TWBridge { | |||
} | |||
(globalThis as any).X_SDK_NAME = "UnitySDK_WebGL"; | |||
(globalThis as any).X_SDK_PLATFORM = "unity"; | |||
(globalThis as any).X_SDK_VERSION = "4.5.1"; | |||
(globalThis as any).X_SDK_VERSION = "4.6.0"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no way to automate this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, I make builds before every version either way to grab latest ts updates
…dev/js into firekeeper/client-analytics-v2
/release-pr |
/release-pr |
Problem solved
Short description of the bug fixed or feature added
Changes made
How to test