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: integrate analytics #244

Merged
merged 5 commits into from
Dec 15, 2021
Merged

feat: integrate analytics #244

merged 5 commits into from
Dec 15, 2021

Conversation

Pianist038801
Copy link
Contributor

Signed-off-by: Pianist038801 steven@union.ai

This integrates Google Analytics into the console application.

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Tracking Issue

fixes flyteorg/flyte#1442

Follow-up issue

NA

@codecov
Copy link

codecov bot commented Nov 23, 2021

Codecov Report

❗ No coverage uploaded for pull request base (master@e2ebf33). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #244   +/-   ##
=========================================
  Coverage          ?   63.08%           
=========================================
  Files             ?      370           
  Lines             ?     8115           
  Branches          ?     1435           
=========================================
  Hits              ?     5119           
  Misses            ?     2996           
  Partials          ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e2ebf33...4e6089b. Read the comment docs.

env.js Outdated
@@ -27,6 +27,10 @@ const STATUS_URL = process.env.STATUS_URL;
// This should only be used when Admin is also in unsecured mode.
const DISABLE_AUTH = process.env.DISABLE_AUTH;

// Configure Google Analytics
const DISABLE_GA = process.env.DISABLE_GA;
const GA_TRACKING_ID = process.env.GA_TRACKING_ID;
Copy link
Contributor

@jsonporter jsonporter Nov 23, 2021

Choose a reason for hiding this comment

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

We want this to default to G-0QW4DJWJ20. so process.env.GA_TRACKING_ID || 'G-0QW4DJWJ20

src/client.tsx Outdated
@@ -11,6 +12,12 @@ const render = (Component: React.FC) => {
const initializeApp = () => {
const App = require('./components/App/App').App;

const { DISABLE_GA, GA_TRACKING_ID } = env;

if (!DISABLE_GA) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem to work as intended. ENV values of "false" or false both don't seem to fire this.

Signed-off-by: Pianist038801 <steven@union.ai>
Pianist038801 added 2 commits December 14, 2021 12:11
README.rst Outdated

This application makes use of the `react-ga4 <https://github.com/PriceRunner/react-ga4>`_
libary to include Google Analytics tracking code in a website or app. For all the environments, it is configured using ENABLE_GA environment variable.
By default, it's enabled like this: ``ENABLED=true``. If you want to disable it, just remove the value. (ex. ``ENABLE_GA='``).
Copy link
Contributor

Choose a reason for hiding this comment

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

This says ENABLED=true but it should be ENABLE_GA =true, right?

Signed-off-by: Pianist038801 <steven@union.ai>
src/client.tsx Outdated
@@ -11,6 +12,12 @@ const render = (Component: React.FC) => {
const initializeApp = () => {
const App = require('./components/App/App').App;

const { ENABLE_GA, GA_TRACKING_ID } = env;

if (ENABLE_GA) {
Copy link
Contributor

Choose a reason for hiding this comment

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

All env vars come back as strings so this will always be true if the var exists. That means you'll need to do an explicit check here for either !="false" || !="0".

Signed-off-by: Pianist038801 <steven@union.ai>
Copy link
Contributor

@jsonporter jsonporter left a comment

Choose a reason for hiding this comment

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

lgtm

@flyte-bot
Copy link
Collaborator

🎉 This PR is included in version 0.35.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

govalt pushed a commit that referenced this pull request Jan 15, 2022
* feat: integrate analytics

Signed-off-by: Pianist038801 <steven@union.ai>

* fix: remove DISABLE_AUTH

Signed-off-by: Pianist038801 <steven@union.ai>

* fix: typo in the README

Signed-off-by: Pianist038801 <steven@union.ai>

* fix: analytics configuration

Signed-off-by: Pianist038801 <steven@union.ai>

Co-authored-by: Pianist038801 <steven@union.ai>
Signed-off-by: csirius <85753828+csirius@users.noreply.github.com>
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.

[Core Feature] Integrate Analytics into user-facing tools
3 participants