NIAEFEUP / nijobs-fe

[FRONTEND] A platform for companies to advertise their job opportunities to students
GNU General Public License v3.0
23 stars 3 forks source link

Port analytics to GA4 #318

Closed BrunoRosendo closed 1 year ago

BrunoRosendo commented 1 year ago

closes #230

This PR ports the analytics system from GA3/UA to Google Analytics 4.

This should be currently enough to have it running but I still need to test all the functionalities we had previously. I also want to check which new functionalities we might want to use or change from GA3, since GA4 remade how data is handled.

Since GA4 is completely different from GA3, it doesn't seem to be possible to port data over so we'll have to start recording again from the day we release the new version.

I also created new GA4 properties in NIJobs analytics account but I still need to check for extra configurations

BrunoRosendo commented 1 year ago

Data is already flowing to the new property in GA4. It'll also continue flowing to GA3 until 1st of July.

GA4 has a complete new interface and data flow but Google makes the transition easier by automatically translating old mechanisms to the new ones. GA4 is IMO simpler than GA3, everything is based on events and event parameters.

This means we can still use the old API (e.g. dimensions and old event system) and they'll all be converted into events and event parameters. This also means our code isn't very clear when compared to the new dashboard. I think we can change that later since porting over is what's mostly important right now.

Additionally, since the dashboard is brand new, we should also setup reports and charts in the new properties, which can be done in the staging property after merging to dev. GA4 offers more flexibility and less OOTB reports, so we need to generate our own.

I will be pushing the final version (code barely changes) in a while and asking for review

BrunoRosendo commented 1 year ago

I've yet to successfully generate charts using our previous custom dimensions but it should be possible, by the documentation

image

Nevertheless, I created #319 to use the new event system properly

BrunoRosendo commented 1 year ago

I also created #320 for the archive

BrunoRosendo commented 1 year ago

I found some problems with the events, I need to figure out how to properly set this up to be completely compatible with timings and other events https://www.thyngster.com/performance-timing-tracking-with-google-analytics-4

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 75.00% and no project coverage change.

Comparison is base (7f34686) 89.07% compared to head (b02eab4) 89.07%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #318 +/- ## ======================================== Coverage 89.07% 89.07% ======================================== Files 176 176 Lines 3395 3395 Branches 855 855 ======================================== Hits 3024 3024 Misses 371 371 ``` | [Impacted Files](https://app.codecov.io/gh/NIAEFEUP/nijobs-fe/pull/318?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NIAEFEUP) | Coverage Δ | | |---|---|---| | [src/utils/analytics/index.js](https://app.codecov.io/gh/NIAEFEUP/nijobs-fe/pull/318?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NIAEFEUP#diff-c3JjL3V0aWxzL2FuYWx5dGljcy9pbmRleC5qcw==) | `85.96% <72.72%> (ø)` | | | [src/utils/index.js](https://app.codecov.io/gh/NIAEFEUP/nijobs-fe/pull/318?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NIAEFEUP#diff-c3JjL3V0aWxzL2luZGV4Lmpz) | `90.43% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

BrunoRosendo commented 1 year ago

@Naapperas can you do something about codecov? There is nothing to test on those lines