-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from EyeSeeTea/feature/add-ga4
Add Google Analytics 4 and remove feedback
- Loading branch information
Showing
14 changed files
with
36 additions
and
81 deletions.
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
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 |
---|---|---|
@@ -1,2 +1,6 @@ | ||
# home-page-app-dev | ||
Home Page app is a DHIS2 app that allows to create dynamic landing pages in DHIS2 | ||
|
||
### Google analytics | ||
|
||
In order to send home page views to Google Analytics, the GA4 code must be provided in the ```.env``` file under ```REACT_APP_GOOGLE_ANALYTICS_4='Your GA4 code'```. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
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
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
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
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,15 @@ | ||
export function sendAnalytics(name: string, data?: object) { | ||
if (!window.gtag) throw new Error("gtag() function has not been declared."); | ||
window.gtag( | ||
"event", | ||
name, | ||
data | ||
// Relevant params to track. Only add if the client allows it | ||
// data && { | ||
// ...data, | ||
// location_hash: window.location.hash, | ||
// location_pathname: window.location.pathname, | ||
// location_href: window.location.href, | ||
// } | ||
); | ||
} |