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(React): React App Analytics (WIP) #2435

Closed
wants to merge 8 commits into from

Conversation

jjoyce0510
Copy link
Collaborator

@jjoyce0510 jjoyce0510 commented Apr 21, 2021

Scope
These changes only impact the React client.

Changes
This PR introduces a generalized analytics module for tracking:

  1. Generic Page View Events
  2. Custom Tracking Events (actions, clicks, etc)

inside the React app. With this PR, we will the ability to easily support to a variety of backend analytics providers like

  • Google Analytics
  • Mixpanel
  • Segment
  • Amplitude
  • Custom Backend

& many others

We achieve this by building a small extension on top of the popular Analytics library, which supports many analytics providers out of the box.

In this PR, we introduce support for Google Analytics, Mixpanel, Amplitude, & a logging provider for testing, as well as implement a series of custom tracking events:

  • LogInEvent
  • LogOutEvent
  • EntityViewEvent
  • SearchEvent
  • SearchResultClickEvent
  • BrowseResultClickEvent

that will allow you to understand your users behavior on the DataHub platform.

As of now, configuring an analytics provider (plugin) requires changing code under the "plugins" directory of the analytics module inside datahub-web-react. In a follow up PR, we intend to expose these configurations via environment variables on the datahub-frontend-react Docker container, allowing you to configure product analytics without modifying code.

Status
Work in progress. Will be providing a richer README with details on supporting additional providers, configuring a provider, etc.

Example
Mixpanel Dashboard showing metrics collected using the framework.

Screen Shot 2021-04-21 at 12 31 38 PM

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable)

timestamp?: number;
urn?: string;
date?: string;
userAgent?: string;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

deviceId --> also remember this is not a session token

*/
export interface BaseEvent {
type: EventType;
actor?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

actorUrn?

type: EventType;
actor?: string;
timestamp?: number;
urn?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

objectUrn?

@jjoyce0510
Copy link
Collaborator Author

Taking another pass to address comments & add additional tracking

@shirshanka
Copy link
Contributor

Closed via #2499

@shirshanka shirshanka closed this May 12, 2021
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