ELK as replacement for google analytics possible?

Our startup has built a SaaS web application used by multiple customers.
The initial solution of using google analytics to track our application usage is not suitable anymore, and I would like to switch to some other solution, not only to track usage, but also monitoring , reporting, data visualization etc.

I don't understand if the Elastic Stack can be used to monitor the usage of a web application and how can be done.
I imagine that server logs can be analysed and provide usage information.

But what about front end? are there any js script that can be injected, like google analytics or other solutions?
Or it is something I should build myself?

Since I would like to use elastic stack also for other reasons, it would be great if it can be used also for this purpose.

Any idea or reading entry point would be great.

As long as you can get the data from the web application you should be able to use Elastic Stack. Fortunately you have a lot of mechanisms available to fetch data, even if the app is running in within a cloud provider such as AWS. Check out both the Beats agents, as well as the multiple Logstash inputs. You will probable find something that will work.

Obviously there is Kibana for visualization of the data. You can also provide your users a view of the data by embedding a Kibana visualization, or even an entire dashboard, within any webpage they have access too. Kibana even provides you with the URL to use. It is basically copy-paste.