Is it possible to handle the analytics.js library to send the events to my own backend instead of going through configured third party plugins? Or is there any way to implement a plugin with my own api, so it will send to my backend?
I tried importing analytics.js to my index.html and follow some instructions from the documentation, but to load the library, it says analytics.load('YOUR_KEY'), but for my case, I don´t think if this YOUR_KEY is necessary, since I would not like to implement a plugin.
First of all, I believe analytics.js is the legacy GA library. It does not support custom endpoints for tracking.
Try Matomo. It's open source and supports you hosting analytics on your own backend.