Skip to content

Commit

Permalink
change some of the calls to react-ga4 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
sunu committed Oct 4, 2023
1 parent 7997da5 commit a76322c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default function DocumentChangelogModal(props) {

useEffect(() => {
if (revealed) {
ReactGA.modalview('document-changelog');
ReactGA.send({ hitType: 'modalview', page: '/modal/document-changelog' });
}
}, [revealed]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function DocumentInfoModal(props) {

useEffect(() => {
if (revealed) {
ReactGA.modalview('document-info');
ReactGA.send({ hitType: 'modalview', page: '/modal/document-info' });
}
}, [revealed]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export default function DocumentTrackerModal(props) {

useEffect(() => {
if (revealed) {
ReactGA.modalview('document-progress-tracker');
ReactGA.send({ hitType: 'modalview', page: '/modal/document-progress-tracker' });

Check failure on line 143 in app/assets/scripts/components/documents/document-tracker-modal.js

View workflow job for this annotation

GitHub Actions / lint

Replace `·hitType:·'modalview',·page:·'/modal/document-progress-tracker'` with `⏎········hitType:·'modalview',⏎········page:·'/modal/document-progress-tracker'⏎·····`
}
}, [revealed]);

Expand Down
12 changes: 10 additions & 2 deletions app/assets/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,17 @@ const { gaTrackingCode } = config;
// Google analytics
if (gaTrackingCode) {
ReactGA.initialize(gaTrackingCode);
ReactGA.pageview(window.location.pathname + window.location.search);
// ReactGA.initialize(gaTrackingCode, {
// gaOptions: {
// debug_mode: true,
// },
// gtagOptions: {
// debug_mode: true,
// },
// });
ReactGA.send({ hitType: 'pageview', page: window.location.pathname + window.location.search})

Check failure on line 95 in app/assets/scripts/main.js

View workflow job for this annotation

GitHub Actions / lint

Replace `·hitType:·'pageview',·page:·window.location.pathname·+·window.location.search})` with `⏎····hitType:·'pageview',⏎····page:·window.location.pathname·+·window.location.search⏎··});`

Check failure on line 95 in app/assets/scripts/main.js

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon
history.listen((location) =>
ReactGA.pageview(location.pathname + location.search)
ReactGA.send({ hitType: 'pageview', page: location.pathname + location.search})

Check failure on line 97 in app/assets/scripts/main.js

View workflow job for this annotation

GitHub Actions / lint

Replace `·hitType:·'pageview',·page:·location.pathname·+·location.search` with `⏎······hitType:·'pageview',⏎······page:·location.pathname·+·location.search⏎····`
);
}

Expand Down

0 comments on commit a76322c

Please sign in to comment.