homebase-app icon indicating copy to clipboard operation
homebase-app copied to clipboard

homebase-app: Implementation and Configuration of Event Tracking with Mixpanel

Open benefacto opened this issue 1 year ago • 8 comments
trafficstars

Description: The existing integration of Mixpanel in the Homebase-App is incomplete, specifically in the area of event tracking. Although the Mixpanel package is installed, it has not been configured to track any specific events. The objective is to design and implement methods for tracking events that have been identified as important by the business, as detailed in the provided document (link).

The task involves a blend of front-end and back-end development work to ensure comprehensive and accurate tracking of user interactions and other relevant events within the homebase stack.

Tasks:

  1. Event Identification: Review the document provided by the business to understand and list all the events that need to be tracked.

  2. Design Event Tracking Methods: Develop a strategy for tracking these events, considering where and how they occur within the application. This step involves deciding on the triggers for event tracking and the data to be collected for each event.

  3. Front-End Implementation: Implement the tracking mechanisms on the front end. This involves coding the necessary triggers in the user interface components where the events occur, ensuring that the right data is captured.

  4. Back-End Integration: Set up the necessary back-end processes for event tracking. This may include configuring the server-side Mixpanel API, handling data transmission, and ensuring secure and efficient data flow from the front end to Mixpanel.

  5. Testing and Verification: Thoroughly test the implemented tracking methods to ensure that events are being captured accurately and consistently. Verify that the data transmitted to Mixpanel is correct and usable for analytics.

  6. Documentation and Guidelines: Update the project documentation to include details about the event tracking implementation. Create guidelines for any future modifications or additions to the tracking setup.

Expected Outcome: A fully operational event tracking system within the homebase stack, accurately capturing and transmitting data to Mixpanel for effective analytics and insights.

Additional Notes:

  • Ensure that the implementation adheres to best practices for data privacy and security.
  • The configuration should be scalable and maintainable, with clear documentation for future updates or modifications.

benefacto avatar Dec 29 '23 03:12 benefacto

It seems like Mixpanel is not tracking any events as this is never present in the code: mixpanel.track("An event");

benefacto avatar Dec 30 '23 01:12 benefacto

Confirmed that Mixpanel is setup on the front end, just not tracking anything. Found this document that appears to delineate what it was intended to track: https://docs.google.com/document/d/1vZ0-9zLu1B1D8zaBVKySt8y-9xvg0FcP1gDhDoUjrxg/edit?usp=sharing

benefacto avatar Dec 30 '23 02:12 benefacto

Updated issue description to reflect this fact

benefacto avatar Dec 30 '23 03:12 benefacto

There is code that is generating events already but not working; need to dive deeper with Manank on this. ~~Andrei may have the login.~~ (have access now)

benefacto avatar Jan 02 '24 19:01 benefacto

Andrei to provide which user actions to track; Ben to figure out how to track performance

benefacto avatar Jan 03 '24 23:01 benefacto

Performance-Related Events to Implement

Homebase https://github.com/dOrgTech/homebase-app/tree/master/src/services

  • Agora
    • Start of Request: Track when the request starts.
    • Success: Track when the request completes successfully.
    • Error: Track when the request fails.
    • Performance Metrics: Track how long the request takes.
  • Tezos Explorer (bakingBad, utils)
    • Socket subscriptions
      • Connection Start: When the socket connection is initiated.
      • Connection Success: When the connection is successfully established.
      • Connection Error: If there's an error in the connection.
      • Message Received: When a message is received from the socket.
      • Disconnection: When the socket connection is closed.
    • Delegations
      • Start of Request: Track when the request starts.
      • Success: Track when the request completes successfully.
      • Error: Track when the request fails.
      • Performance Metrics: Track how long the request takes.
    • Lambdas
      • Start of Request: Track when the request starts.
      • Success: Track when the request completes successfully.
      • Error: Track when the request fails.
      • Performance Metrics: Track how long the request takes.
    • Stats
      • Start of Request: Track when the request starts.
      • Success: Track when the request completes successfully.
      • Error: Track when the request fails.
      • Performance Metrics: Track how long the request takes.
    • Token balances
      • Start of Request: Track when the request starts.
      • Success: Track when the request completes successfully.
      • Error: Track when the request fails.
      • Performance Metrics: Track how long the request takes.
    • Transfers
      • Start of Request: Track when the request starts.
      • Success: Track when the request completes successfully.
      • Error: Track when the request fails.
      • Performance Metrics: Track how long the request takes.
    • Utils
      • Start of Request: Track when the request starts.
      • Success: Track when the request completes successfully.
      • Error: Track when the request fails.
      • Performance Metrics: Track how long the request takes.
  • Beacon
    • Track Wallet Connections: When a user successfully connects their wallet, it's a key interaction. You can track this by adding a Mixpanel event in the connect function after the wallet connection is established.
    • Monitor Network Changes: If your application allows users to change networks, tracking this can provide insights into user preferences and behavior. Place a Mixpanel event in the changeNetwork function to track when users switch networks.
    • Track Disconnects or Resets: Knowing when users disconnect their wallet can help understand user session lengths or potential issues with the wallet integration. Add a Mixpanel event in the reset function to track these occurrences.
    • Identify Users: Mixpanel's identify function is already used in your connect function, which is good practice. This helps in associating the events with the specific user.
    • Custom Metrics: Depending on your application's needs, you might want to track custom metrics, like the frequency of certain interactions, errors during wallet connections, or the duration of sessions.
  • Services DAO
    • Start of Request: Track when the request starts.
    • Success: Track when the request completes successfully.
    • Error: Track when the request fails.
    • Performance Metrics: Track how long the request takes.
  • TZProfile
    • Start of Request: Track when the request starts.
    • Success: Track when the request completes successfully.
    • Error: Track when the request fails.
    • Performance Metrics: Track how long the request takes.
  • Integrate Google Lighthouse: https://www.netlify.com/blog/view-google-lighthouse-scores-visualizations/

baseDAO-dockerized: https://github.com/dOrgTech/baseDAO-dockerized/blob/master/src/controllers/steps.ts

  • Start of Request: Track when the request starts.
  • Success: Track when the request completes successfully.
  • Error: Track when the request fails.
  • Performance Metrics: Track how long the request takes.

homebase-lite-backend: https://github.com/dOrgTech/homebase-lite-backend/tree/main/routes (all routes via Express middleware)

benefacto avatar Jan 10 '24 22:01 benefacto

FYI, @EightRice , while I was digging into the code I noticed that some user events are already being tracker: https://github.com/search?q=repo%3AdOrgTech%2Fhomebase-app%20mixpanel.track&type=code You can see them here: https://mixpanel.com/project/2578633/view/3118029/app/events

benefacto avatar Jan 10 '24 23:01 benefacto

the events are actually being sent to Mixpanel (for the most part).

EightRice avatar Jan 13 '24 01:01 EightRice