Skip to content

Commit

Permalink
HMW-650 Debugging gtag setup in cloud.gov
Browse files Browse the repository at this point in the history
  • Loading branch information
cschwinderg committed Jan 8, 2024
1 parent 3c64c54 commit 65bc93d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions app/client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -435,17 +435,22 @@
// Configure analytics destinations for non-production environments.
// Production will use the analytics injected by the EPA template.
let trackingId;
console.log('window.location.hostname: ', window.location.hostname);
if (window.location.hostname === 'mywaterway-stage.app.cloud.gov') {
console.log('setup gtag for staging...');
// Stage
trackingId = 'G-8ZG01NLPFL';
configureGoogleAnalytics(trackingId);
} else if (
window.location.hostname === 'mywaterway-dev.app.cloud.gov' ||
window.location.hostname === 'localhost'
) {
console.log('setup gtag for dev/localhost...');
// Dev
trackingId = 'G-X6JSLPJCWP';
configureGoogleAnalytics(trackingId, true);
} else {
console.log('skip gtag setup...');
}

// Wrapper for logging to GA
Expand Down
4 changes: 2 additions & 2 deletions app/client/src/components/shared/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ function Page({ children }: Props) {
Contact Us
</a>
</li>
{(process.env.NODE_ENV === 'local' ||
process.env.NODE_ENV === 'development') && (
{(window.location.hostname === 'mywaterway-dev.app.cloud.gov' ||
window.location.hostname === 'localhost') && (
<li>
<button
onClick={() => {
Expand Down

0 comments on commit 65bc93d

Please sign in to comment.