I'm currently using antonioribeiro/tracker
for some stats on my Laravel.
I'm struggling using the do_not_track_routes
array in the config.
I just try to disable the tracker to track admin route, but it doesn't work.
'do_not_track_routes' =>
[
'admin.*',
]
/* Admin routes */
Route::group(['namespace' => 'Admin', 'as'=>'admin', 'prefix' => 'admin1452872135', 'middleware' => ['auth', 'admin', 'language']], function () {
//some route
});
Even this keep the tracker to insert new sessions...
'do_not_track_routes' =>
[
'*',
]
I really try everything that came to my mind, I'll be thankfull for some help...
Get my own answer after debugging inside the package ... In fact,
do_not_track_routes
is never used in theTracker.php
(vendor\pragmarx\tracker\src\Tracker.php
)So I update the isTrackable method like that :
And add this new method, to check if the current URL is in the
do_not_track_route
array :Work well for me, if you find a better answer, I'm in ! :)
You must indicate your route's name (not the URI) under
do_not_track_routes
.So if your route is defined as
'as'=>'admin'
your tracker config must beIn response to @Jiedara,
do_not_track_routes
is used inPragmaRX\Tracker\Data\Repositories\Route
which checks if it includes$route->currentRouteName()
.$route
is an instance ofIlluminate\Routing\Router
and thecurrentRouteName()
method indeed provides the route's name.