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

Add Google Analytics configuration #249

Merged
merged 5 commits into from
Feb 16, 2022
Merged

Conversation

kylelaker
Copy link
Contributor

This adds basic, optional configuration of Google Analytics if the
REACT_APP_GOOGLE_ANALYTICS environment variable is present at the time
that npm run build is executed. This makes it easy to integrate and
fairly self-contained. While the react-ga library's code will be bundled
into the deployed app and the code to do the configuration will be as
well, the initialize won't actually happen unless that value was present
at build time.

At the moment, we just initialize and collect default metrics and
perform a "pageview" action within the App's useEffect (which we may
want to consider moving to some sort of an action on the Router but we
don't seem to have a full Router; we only have a Switch).

example/src/App.js Outdated Show resolved Hide resolved
Copy link
Contributor

@rgauss rgauss left a comment

Choose a reason for hiding this comment

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

Possible alternative, looks like linting is complaining about other stuff as well.

example/src/App.js Outdated Show resolved Hide resolved
@kylelaker kylelaker marked this pull request as ready for review February 14, 2022 15:45
kylelaker and others added 4 commits February 14, 2022 18:55
This adds basic, optional configuration of Google Analytics *if* the
`REACT_APP_GOOGLE_ANALYTICS` environment variable is present at the time
that `npm run build` is executed. This makes it easy to integrate and
fairly self-contained. While the react-ga library's code will be bundled
into the deployed app and the code to do the configuration will be as
well, the initialize won't actually happen unless that value was present
at build time.

At the moment, we just initialize and collect default metrics and
perform a "pageview" action within the App's `useEffect` (which we may
want to consider moving to some sort of an action on the Router but we
don't seem to have a full Router; we only have a Switch).
Co-authored-by: Ray Gauss II <rgauss@easydynamics.com>
@kylelaker kylelaker merged commit ad58785 into develop Feb 16, 2022
@kylelaker kylelaker deleted the feature/add-google-analytics branch February 16, 2022 22:06
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.

None yet

4 participants