I am developing an Ionic Application and i want to know which users logged in, which views they went and what errors they faced.
PS: Tried Google Analytics but it is very slow in updating. I need a real time solution for simple usage.
There is not a straight forward answer to your question.
Ionic/Angular are front-end applications which generally make calls to exposed endpoints, which in turn, communicate with the database, in your case SQL.
1) Setup an endpoint on your backend and write some simple logic to accept a message (error msg, which user is logged in, event that happened) to be written to the database.
2) Create a factory/service that will make an aJax call to that endpoint (you'll need to pass your message to this factory from the UI)
3) Use something like $log in Angular to pass the message you want to database to the factory.
You cannot simple hit SQL from Angular and honestly, it is a really bad idea (if you could).