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 React GA component for analytics support #179

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion apps/public-reference/layouts/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ import SVG from "react-inlinesvg"
import FooterNav from "@bloom-housing/ui-components/src/footers/FooterNav/FooterNav"
import FooterSection from "@bloom-housing/ui-components/src/footers/FooterSection/FooterSection"
import ExygyFooter from "@bloom-housing/ui-components/src/footers/ExygyFooter"
import ReactGA from "react-ga"

export default class extends Component {
public componentDidMount() {
// console.log("DOING A THING!")
if (process.env.gaAnalytics) {
ReactGA.initialize(process.env.gaAnalytics)
ReactGA.pageview(window.location.pathname + window.location.search)
}
}

public render() {
Expand Down
3 changes: 2 additions & 1 deletion apps/public-reference/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ module.exports = withMDX(
env: {
listingServiceUrl: LISTING_SERVICE_URL,
mapBoxToken: MAPBOX_TOKEN,
housingCounselorServiceUrl: HOUSING_COUNSELOR_SERVICE_URL
housingCounselorServiceUrl: HOUSING_COUNSELOR_SERVICE_URL,
gaAnalytics: process.env.GA_ANALYTICS
},
sassLoaderOptions: {
prependData: tailwindVars
Expand Down
1 change: 1 addition & 0 deletions apps/public-reference/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"node-sass": "^4.12.0",
"react": "16.12.0",
"react-dom": "16.12.0",
"react-ga": "^2.7.0",
"react-inlinesvg": "^1.2.0"
},
"devDependencies": {
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12908,6 +12908,11 @@ react-from-dom@^0.3.0:
resolved "https://registry.yarnpkg.com/react-from-dom/-/react-from-dom-0.3.1.tgz#49ba6e7d679314807786aa88a37436ec73637bce"
integrity sha512-PeNBa8iuzoD7qHA9O7YpGnXFvC+XFFwStmFh2/r2zJAvEIaRg6EwOj+EPcDIFwyYBhqPIItxIx/dGdeWiFivjQ==

react-ga@^2.7.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/react-ga/-/react-ga-2.7.0.tgz#24328f157f31e8cffbf4de74a3396536679d8d7c"
integrity sha512-AjC7UOZMvygrWTc2hKxTDvlMXEtbmA0IgJjmkhgmQQ3RkXrWR11xEagLGFGaNyaPnmg24oaIiaNPnEoftUhfXA==

react-helmet-async@^1.0.2:
version "1.0.4"
resolved "https://registry.yarnpkg.com/react-helmet-async/-/react-helmet-async-1.0.4.tgz#079ef10b7fefcaee6240fefd150711e62463cc97"
Expand Down