Hi Bronwyn and thank you for your reply
Eventually I realized that there is a different way to implement the code for gtag. Unfortunately I found this information outside of google's official documentation after a lot of searching. Could be helpful to emphasize this to save time for other users.
The code is working fine now, thank you
Source : https://www.en.advertisercommunity.com/t5/Google-Analytics-Code/Google-event-tracking-not-working/m-p/1635802Thank You for Visiting My Website