I have tried using multiple Google Analytics packages including angular-gtag and many other packages available.
When it comes to sending a custom event from TS, I always get the error of gtag is not defined, even though it is declared under the constructor as public gtag:Gtag and the according packages installed and imported.
I have wasted an incredible amount of time trying to solve this problem.
I can use Google Analytics with the general script in index.html without any problems, but when it comes to sending custom events from TS, I am unable to send anything.
What are some packages or solutions I can implement to be able to send custom events?
I’ve tried everything online to the dot and at the end of the day I keep receiving “gtag is not defined” even though everything is done accordingly, imported, installed, referenced, declared.
I’ve also tried using the code here: https://www.simpleanalytics.com/glossary/google-analytics/add-google-analytics-to-angular
Things just don’t work at all