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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: analytics events for credits/awards #4291

Merged
merged 5 commits into from
Mar 18, 2025

Conversation

rebelchris
Copy link
Contributor

@rebelchris rebelchris commented Mar 14, 2025

Changes

Tried to go for a very generic approach to tracking events based on entity type.
(Separate ticket for the paddle related changes opened)

Events

Did you introduce any new tracking events?

All new events:

start award post
pick award post
award post
start award comment
pick award comment
start award user
pick award user
award user
award comment
start buying credits
select credits quantity

Experiment

Did you introduce any new experiments?

Manual Testing

Caution

Please make sure existing components are not breaking/affected by this PR

Jira ticket

AS-1037

Preview domain

https://as-1037-analytics-events.preview.app.daily.dev

@rebelchris rebelchris requested a review from a team as a code owner March 14, 2025 12:14
@rebelchris rebelchris requested review from omBratteng, ilasw, capJavert, sshanzel, nensidosari and AmarTrebinjac and removed request for a team March 14, 2025 12:14
Copy link

vercel bot commented Mar 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
daily-webapp ✅ Ready (Inspect) Visit Preview Mar 18, 2025 7:47am
1 Skipped Deployment
Name Status Preview Updated (UTC)
storybook ⬜️ Ignored (Inspect) Mar 18, 2025 7:47am

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces new analytics tracking events for credits and awards, while refactoring logging in various components. The key changes include:

  • Integrating new LogEvent and Origin entries and updating the logging functions.
  • Updating components such as the earnings page, award and buy cores modals, and action buttons to emit tracking events.
  • Enhancing context providers to pass additional logging properties such as origin.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/webapp/pages/earnings.tsx Adds logging to track buying credits and award events via updated BuyCore component and button actions.
packages/shared/src/contexts/GiveAwardModalContext.tsx Updates award event logging with new mapping and includes post logging for non-user awards.
packages/shared/src/lib/log.ts Introduces new LogEvent and Origin entries for credits and awards tracking.
packages/shared/src/components/modals/award/GiveAwardModal.tsx Incorporates award logging on modal interactions and refactors event logging callbacks.
packages/shared/src/components/cores/CoreOptionButton.tsx Adds logging on credit option selection using the new SelectCreditsQuantity event.
packages/shared/src/components/credit/BuyCreditsButton.tsx Modifies the buy credits button to track clicks with the new StartBuyingCredits event.
packages/shared/src/components/award/AwardButton.tsx Passes the post property for award tracking when opening the award modal.
packages/shared/src/contexts/BuyCoresContext.tsx Enhances the context with an origin property for improved event logging.
packages/shared/src/components/modals/award/BuyCoresModal.tsx Propagates the origin in the context provider for consistent logging in the buy cores flow.
packages/shared/src/components/comments/CommentActionButtons.tsx Passes the post property to the AwardButton to facilitate complete logging data.

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces analytics tracking for credits and awards by integrating new logging events into both the webapp and shared code packages. Key changes include:

  • Adding logging for credit purchase and award events (including new origins, event names, and tracking callbacks).
  • Extending contexts and UI components (e.g., Award modal, Buy Credits Button, CoreOptionButton) to capture user interactions.
  • Propagating the new Origin property through various contexts and components for consistent event tracking.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/webapp/pages/earnings.tsx Integrates logging for core purchases and updates UI elements with event tracking.
packages/shared/src/contexts/GiveAwardModalContext.tsx Adds logging functionality to award modal context and maps award events to tracking events.
packages/shared/src/lib/log.ts Extends log enumerations with credit and award-related events and origins.
packages/shared/src/components/modals/award/GiveAwardModal.tsx Enhances the Award modal by logging user interactions on award selection and submission.
packages/shared/src/components/credit/BuyCreditsButton.tsx Implements event tracking for credit buying by logging when the button is clicked.
packages/shared/src/components/cores/CoreOptionButton.tsx Introduces event logging for core option selection with a comment indicating a potential improvement.
packages/shared/src/contexts/BuyCoresContext.tsx Passes the new Origin property into the checkout context to track source information.
packages/shared/src/components/modals/award/BuyCoresModal.tsx Propagates the Origin prop through context for accurate tracking in the buy cores flow.
packages/shared/src/components/comments/CommentActionButtons.tsx Updates AwardButton usage by including the post prop for consistent tracking across user actions.
Comments suppressed due to low confidence (1)

packages/shared/src/components/cores/CoreOptionButton.tsx:27

  • The logEvent call uses 'amount: id', which may be incorrect since 'id' likely isn't representative of a numeric credit quantity. Consider revising this to log the actual credit quantity or a more clearly defined property.
logEvent({ event_name: LogEvent.SelectCreditsQuantity, extra: JSON.stringify({ origin, amount: id }) });
@rebelchris rebelchris merged commit cdb8065 into feat-credit-system Mar 18, 2025
10 checks passed
@rebelchris rebelchris deleted the AS-1037-analytics-events branch March 18, 2025 07:50
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.

2 participants