-
Notifications
You must be signed in to change notification settings - Fork 16
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
[ Issue 389 ] Add Google Analytics #453
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
928d053
public vars and gtag
SammySteiner a1e097e
ga tag
SammySteiner 0467a02
Merge branch 'main' into sammysteiner/issue-389-google-analytics
SammySteiner d9e6fc7
gtag needs quotes
SammySteiner 9a29b5b
added environments
SammySteiner 25b2e3e
format
SammySteiner 04ad5eb
Merge branch 'main' into sammysteiner/issue-389-google-analytics
SammySteiner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Define environment variables that you need exposed in the client-side bundle. | ||
* These should not include sensitive secrets! | ||
*/ | ||
const PUBLIC_ENV_VARS_BY_ENV = { | ||
development: { | ||
GOOGLE_ANALYTICS_ID: "GTM-MV57HMHS", | ||
GTM_AUTH: "Xf-LmsD6dhZRJXZz21rZVA", | ||
GTM_PREVIEW: "env-8", | ||
}, | ||
test: { | ||
GOOGLE_ANALYTICS_ID: "GTM-MV57HMHS", | ||
GTM_AUTH: "73_zp32T8ExOVz-f_X56dQ", | ||
GTM_PREVIEW: "env-9", | ||
}, | ||
production: { | ||
GOOGLE_ANALYTICS_ID: "GTM-MV57HMHS", | ||
GTM_AUTH: "hqnD044nMRMTQ0C3XBpbfQ", | ||
GTM_PREVIEW: "env-1", | ||
}, | ||
} as const; | ||
|
||
const NEXT_ENVS = ["development", "test", "production"] as const; | ||
export type NextPublicAppEnv = (typeof NEXT_ENVS)[number]; | ||
|
||
const CURRENT_ENV = process.env.NODE_ENV ?? "development"; | ||
|
||
export const PUBLIC_ENV = PUBLIC_ENV_VARS_BY_ENV[CURRENT_ENV]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is
NODE_ENV
being set? Our application is environment agnostic at the moment, and prefer it that way (have intentionally made decisions to maintain that). Just not sure this will hit anything but"development"
at this point.EDIT: Thanks for explaining offline that it's just how we start the app and what's happening with AWS accounts both being production.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NODE_ENV
is set when we runnpm run start
automagically by node todevelopment
and that is a flag that node uses to set certain configs.npm run test
sets it totest
, and serving it from theserver.js
file sets it toproduction
. We could have more finely tuned control by using env files, but that would add some overhead that I don't think we need yet.