I am using Laravel to build my web site.I installed monolog library to keep logging. I want to log for click event. how can I do this? Please help.
Asked
Active
Viewed 440 times
1 Answers
1
Clicks happen on front-end side.
If you want to log every page load (PHP call) you can use App::before
in app/filters.php
to log every request. More information on that here.
If you want to log every click you might want to use Google Analytics' event tracking. Write some JS to handle all click events and send them to ga
. More information here.

hannesvdvreken
- 4,858
- 1
- 15
- 17
-
Thank you for the answer.please point me to how to catch the click event inside the before() function. – IshaS Apr 23 '14 at 10:33
-
`App::before(function ($request) { $monolog = Logger::getMonolog(); });` – hannesvdvreken Apr 23 '14 at 11:23
-
Class 'Logger' not found exception is thrown after adding the code – IshaS Apr 23 '14 at 11:32
-
1The facade is `Log` instead of `Logger`, but you have found out about that already, isn't it? – hannesvdvreken Apr 23 '14 at 12:35
-
small problem.I want to identify click and post events separately.when I put a message in before function all the events like click,post,ect. print the same message. – IshaS Apr 24 '14 at 04:47
-
found it.I got it by $_SERVER['REQUEST_METHOD']. – IshaS Apr 24 '14 at 06:55
-
1The goal is to -not- use Superglobals. You can get the method with `Request::method();` – hannesvdvreken Apr 24 '14 at 15:12