Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(clerk-react,shared): Add telemetry events for React hooks #3341

Merged
merged 2 commits into from
May 7, 2024

Conversation

LauraBeatris
Copy link
Member

@LauraBeatris LauraBeatris commented May 7, 2024

Description

Resolves SDK-1672

Add telemetry events for useSignIn, useSignUp, useOrganizations and useOrganizationList. This will allow us to track the usage of hooks for custom flows.

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 馃悰 Bug fix
  • 馃専 New feature
  • 馃敤 Breaking change
  • 馃摉 Refactoring / dependency upgrade / documentation
  • other:

@LauraBeatris LauraBeatris self-assigned this May 7, 2024
Copy link

changeset-bot bot commented May 7, 2024

馃 Changeset detected

Latest commit: e24fbfb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@clerk/shared Patch
@clerk/clerk-react Patch
@clerk/backend Patch
@clerk/chrome-extension Patch
@clerk/clerk-js Patch
@clerk/elements Patch
@clerk/clerk-expo Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/remix Patch
@clerk/clerk-sdk-node Patch
@clerk/testing Patch

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

@LauraBeatris LauraBeatris force-pushed the telemetry-react-hooks branch 2 times, most recently from 86126eb to 03dbfa5 Compare May 7, 2024 15:24
@@ -24,6 +26,10 @@ export const useSignIn: UseSignIn = () => {
const isomorphicClerk = useIsomorphicClerkContext();
const client = useClientContext();

useEffect(() => {
isomorphicClerk.telemetry?.record(eventMethodCalled('useSignIn'));
Copy link
Member Author

Choose a reason for hiding this comment

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

Hooks aren't necessary methods per se. However, I don't see the benefits of creating another event type for it, cause it wouldn't change much in terms of querying that data.

Anyway, open for feedback here!

@LauraBeatris LauraBeatris marked this pull request as ready for review May 7, 2024 15:26
@LauraBeatris LauraBeatris requested review from BRKalow, LekoArts and a team and removed request for BRKalow and LekoArts May 7, 2024 15:26
Copy link
Member

@panteliselef panteliselef left a comment

Choose a reason for hiding this comment

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

Maybe in the future we can have eventHookCalled where we track the params passed to those hooks, useful for useOrganization and useOrganizationList, but i'm happy with this for now

packages/react/src/hooks/useSignUp.ts Outdated Show resolved Hide resolved
@LauraBeatris LauraBeatris enabled auto-merge (squash) May 7, 2024 18:41
@LauraBeatris LauraBeatris merged commit 1662aaa into main May 7, 2024
10 checks passed
@LauraBeatris LauraBeatris deleted the telemetry-react-hooks branch May 7, 2024 20:21
@clerk-cookie clerk-cookie mentioned this pull request May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants