I got a web site with a lot of links on it and I want to know which links user chose
I tried to write a small script using JS which send some kind of logs to backend
I want to know is there any method to do this mush easier
I got a web site with a lot of links on it and I want to know which links user chose
I tried to write a small script using JS which send some kind of logs to backend
I want to know is there any method to do this mush easier
I guess if you want to work with spring to get this data, you have two possibilities (probably there are others):
In this case you will create an spring interceptor that will monitor the requests made on your page, in this case user clicks. So, to do this you need to create a class that will contain your rule and extend HandleInterceptor or HandlerInterceptorAdapter and choose which method is best suited to capture the information that is useful to you. The methods provided by the interface are preHandle, postHandle, and afterCompletion. After you create your Interceptor you need to register it with a WebMvcConfigurerAdapter. Here two examples:
Intercepting incoming requests using Spring’s Interceptor
In this case you need to use Spring 5 and Spring-boot 2. With spring events you could get and monitoring many kinds of events, include clicks. In this case you need to create a custom event to contain data related to what you want to monitor, publish it, create a listener and configure a AsynchronousSpringEventsConfig. There are already some pre-created events provided by the framework like RequestHandledEvent and you can test them to see if they fit your case. Here a good link with a good explanation: Spring Events
And with you wish you also use JS and overwrite onclick event like the guy did in this question on stackoverflow.