Giter VIP home page Giter VIP logo

tracker's Introduction

Laravel Stats Tracker

Latest Stable Version License Downloads

Tracker gathers a lot of information from your requests to identify and store:

  • Sessions
  • Page Views (hits on routes)
  • Users (logged users)
  • Devices (computer, smartphone, tablet...)
  • Languages (preference, language range)
  • User Devices (by, yeah, storing a cookie on each device)
  • Browsers (Chrome, Mozilla Firefox, Safari, Internet Explorer...)
  • Operating Systems (iOS, Mac OS, Linux, Windows...)
  • Geo Location Data (Latitute, Longitude, Country and City)
  • Routes and all its parameters
  • Events
  • Referers (url, medium, source, search term...)
  • Exceptions/Errors
  • Sql queries and all its bindings
  • Url queries and all its arguments
  • Database connections

Index

Why?

Storing user tracking information, on indexed and normalized database tables, wastes less disk space and ease the extract of valuable information about your application and business.

Usage

As soon as you install and enable it, Tracker will start storing all information you tell it to, then you can in your application use the Tracker Facade to access everything. Here are some of the methods and relationships available:

Current Session/Visitor

$visitor = Tracker::currentSession();

Most of those methods return an Eloquent model or collection, so you can use not only its attributes, but also relational data:

var_dump( $visitor->client_ip );

var_dump( $visitor->device->is_mobile );

var_dump( $visitor->device->platform );

var_dump( $visitor->geoIp->city );

var_dump( $visitor->language->preference );

Sessions (visits)

$sessions = Tracker::sessions(60 * 24); // get sessions (visits) from the past day
foreach ($sessions as $session)
{
    var_dump( $session->user->email );

    var_dump( $session->device->kind . ' - ' . $session->device->platform );

    var_dump( $session->agent->browser . ' - ' . $session->agent->browser_version );

    var_dump( $session->geoIp->country_name );

    foreach ($session->session->log as $log)
    {
    	var_dump( $log->path );
    }
}

Online Users

Brings all online sessions (logged and unlogged users)

$users = Tracker::onlineUsers(); // defaults to 3 minutes

Users

$users = Tracker::users(60 * 24);

User Devices

$users = Tracker::userDevices(60 * 24, $user->id);

Events

$events = Tracker::events(60 * 24);

Errors

$errors = Tracker::errors(60 * 24);

PageViews summary

$pageViews = Tracker::pageViews(60 * 24 * 30);

PageViews By Country summary

$pageViews = Tracker::pageViewsByCountry(60 * 24);

Filter range

You can send timestamp ranges to those methods using the Minutes class:

$range = new Minutes();

$range->setStart(Carbon::now()->subDays(2));

$range->setEnd(Carbon::now()->subDays(1));

Tracker::userDevices($range);

Routes By Name

Having a route of

Route::get('user/{id}', ['as' => 'user.profile', 'use' => 'UsersController@profile']);

You can use this method to select all hits on that particular route and count them using Laravel:

return Tracker::logByRouteName('user.profile')
        ->where(function($query)
        {
            $query
                ->where('parameter', 'id')
                ->where('value', 1);
        })
        ->count();

And if you need count how many unique visitors accessed that route, you can do:

return Tracker::logByRouteName('tracker.stats.log')
        ->where(function($query)
        {
            $query
                ->where('parameter', 'uuid')
                ->where('value', '8b6faf82-00f1-4db9-88ad-32e58cfb4f9d');
        })
        ->select('tracker_log.session_id')
        ->groupBy('tracker_log.session_id')
        ->distinct()
        ->count('tracker_log.session_id');

Screenshots

Visits

visits

Charts

charts

Users

users

Events

events

Errors

errors

Blade Views

The views above are available in this package, but you need to install the sb-admin panel on your public folder, please look at the instructions below.

How data is stored

All tables are prefixed by tracker_, and here's an extract of some of them, showing columns and contents:

sessions

+-----+--------------------------------------+---------+-----------+----------+-----------------+------------+-----------+----------+-------------+
| id  | uuid                                 | user_id | device_id | agent_id | client_ip       | referer_id | cookie_id | geoip_id | language_id |
+-----+--------------------------------------+---------+-----------+----------+-----------------+------------+-----------+----------+-------------+
| 1   | 09465be3-5930-4581-8711-5161f62c4373 | 1       | 1         | 1        | 186.228.127.245 | 2          | 1         | 2        | 3           |
| 2   | 07399969-0a19-47f0-862d-43b06d7cde45 |         | 2         | 2        | 66.240.192.138  |            | 2         | 2        | 2           |
+-----+--------------------------------------+---------+-----------+----------+-----------------+------------+-----------+----------+-------------+

devices

+----+----------+-------------+-------------+------------------+-----------+
| id | kind     | model       | platform    | platform_version | is_mobile |
+----+----------+-------------+-------------+------------------+-----------+
| 1  | Computer | unavailable | Windows 8   |                  |           |
| 2  | Tablet   | iPad        | iOS         | 7.1.1            | 1         |
| 3  | Computer | unavailable | Windows XP  |                  |           |
| 5  | Computer | unavailable | Other       |                  |           |
| 6  | Computer | unavailable | Windows 7   |                  |           |
| 7  | Computer | unavailable | Windows 8.1 |                  |           |
| 8  | Phone    | iPhone      | iOS         | 7.1              | 1         |
+----+----------+-------------+-------------+------------------+-----------+

agents

+----+-----------------------------------------------------------------------------------------------------------------------------------------+-------------------+-----------------+
| id | name                                                                                                                                    | browser           | browser_version |
+----+-----------------------------------------------------------------------------------------------------------------------------------------+-------------------+-----------------+
| 1  | Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36                           | Chrome            | 35.0.1916       |
| 2  | Mozilla/5.0 (iPad; CPU OS 7_1_1 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) CriOS/34.0.1847.18 Mobile/11D201 Safari/9537.53 | Chrome Mobile iOS | 34.0.1847       |
| 3  | Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)                                                                                      | IE                | 6.0             |
| 4  | Python-urllib/2.6                                                                                                                       | Other             |                 |
| 5  | Other                                                                                                                                   | Other             |                 |
| 6  | Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36                           | Chrome            | 34.0.1847       |
| 7  | Mozilla/5.0 (Windows NT 6.3; rv:28.0) Gecko/20100101 Firefox/28.0                                                                       | Firefox           | 28.0            |
| 8  | Mozilla/5.0 (iPhone; CPU iPhone OS 7_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D169 Safari/9537.53 | Mobile Safari     | 7.0             |
+----+-----------------------------------------------------------------------------------------------------------------------------------------+-------------------+-----------------+

languages

+----+------------+----------------+
| id | preference | language_range |
+----+------------+----------------+
| 1  | en         | ru=0.8,es=0.5  |
| 2  | es         | en=0.7,ru=0.3  |
| 3  | ru         | en=0.5,es=0.5  |
+----+------------+----------------+

domains

+----+--------------------------+
| id | name                     |
+----+--------------------------+
| 1  | antoniocarlosribeiro.com |
+----+--------------------------+

errors

+----+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id | code | message                                                                                                                                                                                                                      |
+----+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 1  | 404  |                                                                                                                                                                                                                              |
| 2  | 500  | Call to undefined method PragmaRX\Tracker\Tracker::sessionLog()                                                                                                                                                              |
| 3  | 500  | Trying to get property of non-object (View: /home/forge/stage.antoniocarlosribeiro.com/app/views/admin/tracker/log.blade.php)                                                                                                |
| 4  | 500  | syntax error, unexpected 'foreach' (T_FOREACH)                                                                                                                                                                               |
| 5  | 500  | Call to undefined method PragmaRX\Tracker\Tracker::pageViewsByCountry()                                                                                                                                                      |
| 6  | 500  | Class PragmaRX\Firewall\Vendor\Laravel\Artisan\Base contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Illuminate\Console\Command::fire)                                 |
| 7  | 405  |                                                                                                                                                                                                                              |
| 8  | 500  | Trying to get property of non-object                                                                                                                                                                                         |
| 9  | 500  | Missing argument 2 for Illuminate\Database\Eloquent\Model::setAttribute(), called in /home/forge/stage.antoniocarlosribeiro.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php on line 2444 and defined |
+----+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

events

+----+------------------------------------------------+
| id | name                                           |
+----+------------------------------------------------+
| 1  | illuminate.log                                 |
| 2  | router.before                                  |
| 3  | router.matched                                 |
| 4  | auth.attempt                                   |
| 5  | auth.login                                     |
| 6  | composing: admin.tracker.index                 |
| 7  | creating: admin.tracker._partials.menu         |
| 8  | composing: admin.tracker._partials.menu        |
| 9  | creating: admin.layout                         |
| 10 | composing: admin.layout                        |
| 11 | creating: admin._partials.mainMenu             |
| 12 | composing: admin._partials.mainMenu            |
| 13 | creating: admin._partials.messages             |
| 14 | composing: admin._partials.messages            |
| 15 | creating: global._partials.google-analytics    |
| 16 | composing: global._partials.google-analytics   |
+----+------------------------------------------------+

geoip

+----+----------+-----------+--------------+---------------+---------------------------+--------+----------------+-------------+-----------+----------+------------+----------------+
| id | latitude | longitude | country_code | country_code3 | country_name              | region | city           | postal_code | area_code | dma_code | metro_code | continent_code |
+----+----------+-----------+--------------+---------------+---------------------------+--------+----------------+-------------+-----------+----------+------------+----------------+
| 1  | 37.4192  | -122.057  | US           | USA           | United States             | CA     | Mountain View  | 94043       | 650       | 807      | 807        | NA             |
| 2  | -10      | -55       | BR           | BRA           | Brazil                    |        |                |             |           |          |            | SA             |
| 3  | 30.3909  | -86.3161  | US           | USA           | United States             | FL     | Miramar Beach  | 32550       | 850       | 686      | 686        | NA             |
| 4  | 38.65    | -90.5334  | US           | USA           | United States             | MO     | Chesterfield   | 63017       | 314       | 609      | 609        | NA             |
| 5  | 42.7257  | -84.636   | US           | USA           | United States             | MI     | Lansing        | 48917       | 517       | 551      | 551        | NA             |
| 6  | 42.8884  | -78.8761  | US           | USA           | United States             | NY     | Buffalo        | 14202       | 716       | 514      | 514        | NA             |
| 7  | 40.1545  | -75.3809  | US           | USA           | United States             | PA     | Norristown     | 19403       | 610       | 504      | 504        | NA             |
| 8  | 47.4891  | -122.291  | US           | USA           | United States             | WA     | Seattle        | 98168       | 206       | 819      | 819        | NA             |
| 9  | 33.7516  | -84.3915  | US           | USA           | United States             | GA     | Atlanta        | 30303       | 404       | 524      | 524        | NA             |
| 10 | 33.7633  | -117.794  | US           | USA           | United States             | CA     | Santa Ana      | 92705       | 714       | 803      | 803        | NA             |
| 11 | 33.4357  | -111.917  | US           | USA           | United States             | AZ     | Tempe          | 85281       | 480       | 753      | 753        | NA             |
| 12 | 40.7421  | -74.0018  | US           | USA           | United States             | NY     | New York       | 10011       | 212       | 501      | 501        | NA             |
| 13 | 28.6185  | -81.4336  | US           | USA           | United States             | FL     | Orlando        | 32810       | 407       | 534      | 534        | NA             |
| 14 | 38.6312  | -90.1922  | US           | USA           | United States             | MO     | Saint Louis    | 63101       | 314       | 609      | 609        | NA             |
| 15 | 51       | 9         | DE           | DEU           | Germany                   |        |                |             |           |          |            | EU             |
| 16 | 52.5     | 5.75      | NL           | NLD           | Netherlands               |        |                |             |           |          |            | EU             |
| 17 | 48.86    | 2.35      | FR           | FRA           | France                    |        |                |             |           |          |            | EU             |
| 18 | 60       | 100       | RU           | RUS           | Russian Federation        |        |                |             |           |          |            | EU             |
| 19 | 51.5     | -0.13     | GB           | GBR           | United Kingdom            |        |                |             |           |          |            | EU             |
| 20 | 42.8333  | 12.8333   | IT           | ITA           | Italy                     |        |                |             |           |          |            | EU             |
| 21 | 59.3333  | 18.05     | SE           | SWE           | Sweden                    | 26     | Stockholm      |             |           |          |            | EU             |
| 22 | -41      | 174       | NZ           | NZL           | New Zealand               |        |                |             |           |          |            | OC             |
| 23 | 37.57    | 126.98    | KR           | KOR           | Korea, Republic of        |        |                |             |           |          |            | AS             |
| 24 | 1.3667   | 103.8     | SG           | SGP           | Singapore                 |        |                |             |           |          |            | AS             |
| 25 | -43.5333 | 172.633   | NZ           | NZL           | New Zealand               | E9     | Christchurch   | 8023        |           |          |            | OC             |
| 26 | -27.471  | 153.024   | AU           | AUS           | Australia                 | 04     | Brisbane       |             |           |          |            | OC             |
| 27 | 26.9167  | 75.8167   | IN           | IND           | India                     | 24     | Jaipur         |             |           |          |            | AS             |
| 28 | 32       | 53        | IR           | IRN           | Iran, Islamic Republic of |        |                |             |           |          |            | AS             |
| 29 | 32.0617  | 118.778   | CN           | CHN           | China                     | 04     | Nanjing        |             |           |          |            | AS             |
| 30 | -22.9    | -47.0833  | BR           | BRA           | Brazil                    | 27     | Campinas       |             |           |          |            | SA             |
| 31 | 32.8073  | -117.132  | US           | USA           | United States             | CA     | San Diego      | 92123       | 858       | 825      | 825        | NA             |
| 32 | -22.9    | -43.2333  | BR           | BRA           | Brazil                    | 21     | Rio De Janeiro |             |           |          |            | SA             |
+----+----------+-----------+--------------+---------------+---------------------------+--------+----------------+-------------+-----------+----------+------------+----------------+

log

+-----+------------+---------+----------+--------+---------------+---------+-----------+---------+------------+----------+
| id  | session_id | path_id | query_id | method | route_path_id | is_ajax | is_secure | is_json | wants_json | error_id |
+-----+------------+---------+----------+--------+---------------+---------+-----------+---------+------------+----------+
| 1   | 1          | 1       |          | GET    | 1             |         | 1         |         |            |          |
| 2   | 1          | 2       |          | GET    | 2             |         | 1         |         |            |          |
| 3   | 1          | 3       |          | GET    | 3             |         | 1         |         |            |          |
| 4   | 1          | 3       |          | POST   | 4             |         | 1         |         |            |          |
+-----+------------+---------+----------+--------+---------------+---------+-----------+---------+------------+----------+

paths

+----+--------------------------------------------------------+
| id | path                                                   |
+----+--------------------------------------------------------+
| 1  | /                                                      |
| 2  | admin                                                  |
| 3  | login                                                  |
| 4  | admin/languages                                        |
| 5  | admin/tracker                                          |
| 6  | admin/pages                                            |
| 7  | jmx-console                                            |
| 8  | manager/html                                           |
| 9  | administrator                                          |
| 10 | joomla/administrator                                   |
| 11 | cms/administrator                                      |
| 12 | Joomla/administrator                                   |
| 13 | phpmyadmin                                             |
| 14 | phpMyAdmin                                             |
| 15 | mysql                                                  |
| 16 | sql                                                    |
| 17 | myadmin                                                |
| 18 | webdav                                                 |
+----+--------------------------------------------------------+

route_paths

+----+----------+--------------------------------------------------------+
| id | route_id | path                                                   |
+----+----------+--------------------------------------------------------+
| 1  | 1        | /                                                      |
| 2  | 2        | admin                                                  |
| 3  | 3        | login                                                  |
| 4  | 4        | login                                                  |
| 5  | 5        | admin/languages                                        |
| 6  | 6        | admin/tracker                                          |
| 7  | 7        | admin/pages                                            |
+----+----------+--------------------------------------------------------+

routes

+----+--------------------------------------+----------------------------------------------------------+
| id | name                                 | action                                                   |
+----+--------------------------------------+----------------------------------------------------------+
| 1  | home                                 | ACR\Controllers\Home@index                               |
| 2  | admin                                | ACR\Controllers\Admin\Admin@index                        |
| 3  | login.form                           | ACR\Controllers\Logon@form                               |
| 4  | login.do                             | ACR\Controllers\Logon@login                              |
| 5  | admin.languages.index                | ACR\Controllers\Admin\Languages@index                    |
| 6  | admin.tracker.index                  | ACR\Controllers\Admin\Tracker@index                      |
| 7  | admin.pages.index                    | ACR\Controllers\Admin\Pages@index                        |
| 8  | admin.tracker.log                    | ACR\Controllers\Admin\Tracker@log                        |
| 9  | technology                           | ACR\Controllers\Technology@index                         |
| 10 | technology.articles.show             | ACR\Controllers\Technology@show                          |
| 11 | language.select                      | ACR\Controllers\Language@select                          |
| 12 | admin.tracker.summary                | ACR\Controllers\Admin\Tracker@summary                    |
| 13 | admin.tracker.api.pageviews          | ACR\Controllers\Admin\Tracker@apiPageviews               |
| 14 | admin.tracker.api.pageviewsbycountry | ACR\Controllers\Admin\Tracker@apiPageviewsByCountry      |
| 15 | admin.pages.create                   | ACR\Controllers\Admin\Pages@create                       |
| 16 | api.markdown                         | ACR\Controllers\Api@markdown                             |
| 17 | admin.pages.store                    | ACR\Controllers\Admin\Pages@store                        |
| 18 | bio                                  | ACR\Controllers\StaticPages@show                         |
| 19 | logout.do                            | ACR\Controllers\Logon@logout                             |
| 20 | admin.tracker.index                  | ACR\Controllers\Admin\UsageTracker@index                 |
| 21 | admin.tracker.api.pageviewsbycountry | ACR\Controllers\Admin\UsageTracker@apiPageviewsByCountry |
| 22 | admin.tracker.api.pageviews          | ACR\Controllers\Admin\UsageTracker@apiPageviews          |
+----+--------------------------------------+----------------------------------------------------------+

sql_queries ;

+----+------------------------------------------+-------------------------------------------------------------------------------------------------+-------+---------------+
| id | sha1                                     | statement                                                                                       | time  | connection_id |
+----+------------------------------------------+-------------------------------------------------------------------------------------------------+-------+---------------+
| 1  | 5aee121018ac16dbf26dbbe0cf35fd44a29a5d7e | select * from "users" where "id" = ? limit 1                                                    | 3.13  | 1             |
| 2  | 0fc3f3a722b0f9ef38e6bee44fc3fde9fb1fd1d9 | select "created_at" from "articles" where "published_at" is not null order by "created_at" desc | 1.99  | 1             |
+----+------------------------------------------+-------------------------------------------------------------------------------------------------+-------+---------------+

Manually log things

If your application has special needs, you can manually log things like:

Events

Tracker::trackEvent(['event' => 'cart.add']);
Tracker::trackEvent(['event' => 'cart.add', 'object' => 'App\Cart\Events\Add']);

Routes

Tracker::trackVisit(
    [
        'name' => 'my.dynamic.route.name',
        'action' => 'MyDynamic@url'
    ],
    ['path' => 'my/dynamic/url']
);

Requirements

  • Laravel 5+
  • PHP 5.3.7+
  • Package "geoip/geoip":"~1.14" or "geoip2/geoip2":"~2.0" (If you are planning to store Geo IP information)

For Laravel 4+ please use version 2.0.10.

Installing

Require the tracker package by executing the following command in your command line:

composer require pragmarx/tracker

Add the service provider to your app/config/app.php:

 PragmaRX\Tracker\Vendor\Laravel\ServiceProvider::class,

Add the alias to the facade on your app/config/app.php:

'Tracker' => 'PragmaRX\Tracker\Vendor\Laravel\Facade',

Publish tracker configuration:

Laravel 4

php artisan config:publish pragmarx/tracker

Laravel 5

php artisan vendor:publish --provider="PragmaRX\Tracker\Vendor\Laravel\ServiceProvider"

Enable the Middleware (Laravel 5)

Open the newly published config file found at app/config/tracker.php and enable use_middleware:

'use_middleware' => true,

Add the Middleware to Laravel Kernel (Laravel 5)

Open the file app/Http/Kernel.php and add the following to your web middlewares:

\PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker::class,

Enable Tracker in your config.php (Laravel 4) or tracker.php (Laravel 5)

'enabled' => true,

Publish the migration

php artisan tracker:tables

This is only needed if you are on Laravel 4, because vendor:publish does it for you in Laravel 5.

Create a database connection for it on your config/database.php

'connections' => [
    'mysql' => [
        ...
    ],
    
    'tracker' => [
    	'driver'   => '...',
    	'host'     => '...',
    	'database' => ...,
        'strict' => false,    // to avoid problems on some MySQL installs
    	...
    ],
],

Migrate it

If you have set the default connection to tracker, you can

php artisan migrate

Otherwise you'll have to

php artisan migrate --database=tracker

If you are planning to store Geo IP information, also install the geoip package:

composer require "geoip/geoip":"~1.14"

or

composer require "geoip2/geoip2":"~2.0"

And make sure you don't have the PHP module installed. This is a Debian/Ubuntu example:

sudo apt-get purge php5-geoip

Everything Is Disabled By Default

Tracker has a lot of logging options, but you need to decide what you want to log. Starting by enabling this one:

'log_enabled' => true,

It is responsible for logging page hits and sessions, basically the client IP address.

Multiple authentication drivers

You just have to all your auth IOC bidings to the array:

'authentication_ioc_binding' => ['auth', 'admin'],

Stats Panel

To use the stats panel on your website you'll need to download the sb-admin 2 sources to your public folder:

git clone https://github.com/BlackrockDigital/startbootstrap-sb-admin-2.git public/templates/sb-admin-2
cd public/templates/sb-admin-2
git checkout tags/v3.3.7+1
git checkout -b v3.3.7+1

And enabled in your config file:

'stats_panel_enabled' => true,

Set the web middleware for stats routes (Laravel 5)

'stats_routes_middleware' => 'web',

Only admins can view the stats, so if you don't have an is_admin attribute on your user model, you'll have to add one:

public function getIsAdminAttribute()
{
    return true;
}

It can be 'admin', 'is_admin', 'root' or 'is_root'.

Troubleshooting

Is everything enabled?

Make sure Tracker is enabled in the config file. Usually this is the source of most problems.

Tail your laravel.log file

tail -f storage/logs/laravel.log

Usually non-trackable IP addresses and other messages will appear in the log:

[2018-03-19 21:28:08] local.WARNING: TRACKER (unable to track item): 127.0.0.1 is not trackable.

SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'field name'

This is probably related to SQL modes on MySQL, specifically with NO_ZERO_IN_DATE and NO_ZERO_DATE modes:

https://stackoverflow.com/questions/36882149/error-1067-42000-invalid-default-value-for-created-at

Because Laravel's defaults to

set session sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

You may need to change your Tracker database connection configuration to

'connections' => [
    ...

    'tracker' => [
        ...

        'strict'    => false,
    ],
],

Not able to track users?

If you get an error like:

Base table or view not found: 1146 Table 'tracker.users' doesn't exist

You probably need to change:

'user_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\User',

To create (or use a current) a User model:

'user_model' => 'App\TrackerUser',

And configure the Connection related to your users table:

protected $connection = 'mysql';

Not able to track API's?

In your kernel

protected $middlewareGroups = [
    'web' => [
        .......
        \PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker::class,
    ],

    'api' => [
       .......
        \PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker::class,
    ],
];

Author

Antonio Carlos Ribeiro All Contributors

License

Tracker is licensed under the BSD 3-Clause License - see the LICENSE file for details

Contributing

Pull requests and issues are more than welcome.

tracker's People

Contributors

0x15f avatar aleplusplus avatar antonioribeiro avatar arezaie14 avatar ben-nsng avatar bryant1410 avatar consoletvs avatar djam90 avatar doncadavona avatar eadortsu avatar gabriel-cardoso avatar grahamcampbell avatar hafael avatar hamed-netlinks avatar igorhaf avatar kduma avatar kingsloi avatar lasserafn avatar marlocorridor avatar mohabhassan avatar napestershine avatar ndberg avatar rogervila avatar samuelmoraesf avatar scrutinizer-auto-fixer avatar sobolevna avatar thakur-k avatar vinkev avatar xembill avatar yuters avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tracker's Issues

Requires user table?

Hey,
I'm currently testing tracker and I don't have any users to track. Not configured to track them of course. Can I disable that requirement somehow?

Error message:
Base table or view not found: 1146 Table 'db.users' doesn't exist (SQL: select * from users where users.id in (0)

Thanks!

Can not find 'users' table when using custom connection on config.php

Hey bud,

Bas news, now that Tracker works, by tracking on a separated connection/schema, the problem is now the inverse, if I try to call $session->user it tries to find the 'users' table on tracker connection.

However, my 'users' table is on the default connection, so we might need a new connection parameter into config.php or any other solution.

Also, for the record, I might also have problems because the following:

  • My User model is named CoreUser
  • My users table is core_users

So we should also be able to configure these values.

Well, let me know any news.

Thank you and regards,

Robson.

use method non-object

I try to show my current city, but I got an error with "Trying to get property of non-object".
any answer?
Thanks!

Selective logging

It is not clear for me from README, but is there a way to make a selective logging? If I don't want e.g. log geoips or something else?

Use Sentry as user model

Hello,

Thanks for this wonderful package. I tried to use Sentry package (https://cartalyst.com/manual/sentinel#laravel-4) along with below settings:

'authentication_ioc_binding' => 'Cartalyst\Sentry\Sentry',

'authenticated_check_method' => 'check', 

'authenticated_user_method' => 'getUser', 

'authenticated_user_id_column' => 'id', 

'authenticated_user_username_column' => 'email', 

I get the below error. Could you please help me with this.

unserialize(): Error at offset 0 of 328 bytes
Open:
wamp\www\protected\vendor\cartalyst\sentry\src\Cartalyst\Sentry\Cookies\NativeCookie.php
*
* @return mixed
*/
public function getCookie()
{
if (isset($_COOKIE[$this->getKey()]))
{
return unserialize($_COOKIE[$this->getKey()]);
}
}

Error: Session already started

I'm receiving a ErrorException: A session had already been started - ignoring session_start() in my unit tests when I include your service provider.

I haven't dug deep through the code yet but I see a session_start in the register() method. Have you stumbled on this before?

log record generating twice

When page loads same log record generating twice. I tried loading different pages but every time its happening.
please check the screenshot of tracker_log
tracker bug

When are you publising those views?

I don't really care if they don't work out of the box, but it'd be really good just to have the view files, wheather it be in a gist, or whatever.

user model

Can you help me with user model?
I am using sentry

Thanks.

Class 'Tracker' not found

I'am using namespace in my controllers , this is my controller :
[controllers/admin/AdminController.php]

theme = Theme::uses('admin'); $visitor = Tracker::currentSession(); dd($visitor); } public function getIndex() { $the_title = trans("admin.labels.dashboard"); return $this->theme->scope('index',compact('the_title')) ->render(); } ``` }

Class 'Tracker' not found

Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_ERROR)
Class 'Tracker' not found

why

Route::get('test', function() {

$visitor = Tracker::currentSession();
return $visitor;

});

Tracker: Model not found for 'session_model'.

The problem occurs once i changed the app/config/session.php driver to database.
If switching back to driver=file, it will works fine.

Is tracker doesn't support session with driver=database ?

For authentication, i'm using sentry module.

Route model binding and `tracker_route_path_parameters`

It looks like Tracker stored the entire JSON version of the model in the tracker_route_path_paramters' value column instead of the ID when using route model binding.

I haven't quite looked at the code yet so not sure if it's easy to fix.

MySql

Hi

Does tracker support mysql or I would need to use pgsql ??

It possible to define separate database not only connection for tracker??

Thanks.

PHP Parse error

There's an error with PHP Parse error: syntax error, unexpected '$string' (T_VARIABLE) in /home/streamdl/public_html/vendor/pragmarx/support/src/helpers.php on line 767

Line 767 - yield $string;

'yield' only available in PHP version 5.5, below version PHP version 5.5 you will get above error.

Call to a member function getStart() on a non-object

Hi installed tracker and when i run

$sessions = Tracker::sessions(60 * 24); // get sessions (visits) from the past day

or

$users = Tracker::users(60 * 24);

and more ....

i get this error:
D:\WebProjects\DaoLafoes\vendor\pragmarx\tracker\src\Vendor\Laravel\Models\Base.php

public function scopePeriod($query, $minutes, $alias = '')
{
$alias = $alias ? "$alias." : '';

    return $query
            ->where($alias.'updated_at', '>=', $minutes->getStart())
            ->where($alias.'updated_at', '<=', $minutes->getEnd());
}

Can anyone help me ? pls Thanks

Possible sessions table conflict

[via email by Mark Domnin]

Hello, sorry for the delay! I've found the problem. Yeah, I created a new project, imported all my favorite package and then run the website. It worked fine, but then I added sessions table and get the same problem.
So

  1. Change 'driver' in config/session.php from 'file' to 'database',
  2. Create table 'sessions'
  3. Refresh the page.

And here we go. This wierd problem. Then I've rolled back and the problem disappear.
I'm still not a pro in Laravel, so I have no idea how to fix this bug-feature.

"require": {
    "laravel/framework": "4.2.*",
            "barryvdh/laravel-ide-helper": "1.*",
            "codesleeve/asset-pipeline": "dev-master",
            "zizaco/entrust": "1.2.*@dev",
            "pragmarx/tracker": "0.6.*",
    "doctrine/dbal": "~2.3"
},

Prefixed log-table names

Hello! Nice package ๐Ÿ‘
But I think table names should be prefixed with smth like tracker_ to avoid possible conflicts with application's tables.

Enhancement Request: enable or disable the tracker basedon the environment

Antonio,

New idea here, it would also be awesome be able to enable the tracker for example, only on production environment, and disable on stage/development...

We could have an array with environment to not track on config.php like:
'do_no_track_envs' => array('production', 'etc...');

Then you could change 'do_no_track to' 'do_no_track_ips'
Hope it makes sense :)

Thank you,

Robson.

Class tracker does not exist ?

ReflectionException (-1)
Class tracker does not exist

Why ..?
use PragmaRX\Tracker\Vendor\Laravel\Facade as Tracker;
class HomeController extends BaseController {
public function showVisitor()
{
$visitor = Tracker::currentSession();
return $visitor;
}
}

Call to undefined method Migrator::timestamp()

I am getting

Call to undefined method PragmaRX\Tracker\Support\Database\Migrator::timestamp()

and I think it could be to do with the fact that you have

$this->timestamp('created_at')->index();
$this->timestamp('updated_at')->index();

everywhere instead of

$table->timestamp('created_at')->index();
$table->timestamp('updated_at')->index();

Full ERROR:

Migration create_tracker_tables created successfully!
Generating optimized class loader
Running for workbench [fdw/core]...
Running for workbench [fdw/newsletter]...
Running for workbench [fdw/pages]...
Running for workbench [fdw/blog]...
Running for workbench [fdw/cart]...
PHP Fatal error:  Call to undefined method PragmaRX\Tracker\Support\Database\Migrator::timestamp() in /media/bravo/Development/website/bitbucket/website/vendor/pragmarx/tracker/src/Support/Database/Migrator.php on line 61
PHP Stack trace:
PHP   1. {main}() /media/bravo/Development/website/bitbucket/website/artisan:0
PHP   2. Symfony\Component\Console\Application->run() /media/bravo/Development/website/bitbucket/website/artisan:59
PHP   3. Symfony\Component\Console\Application->doRun() /media/bravo/Development/website/bitbucket/website/vendor/symfony/console/Symfony/Component/Console/Application.php:121
PHP   4. Symfony\Component\Console\Application->doRunCommand() /media/bravo/Development/website/bitbucket/website/vendor/symfony/console/Symfony/Component/Console/Application.php:191
PHP   5. Illuminate\Console\Command->run() /media/bravo/Development/website/bitbucket/website/vendor/symfony/console/Symfony/Component/Console/Application.php:885
PHP   6. Symfony\Component\Console\Command\Command->run() /media/bravo/Development/website/bitbucket/website/vendor/laravel/framework/src/Illuminate/Console/Command.php:96
PHP   7. Illuminate\Console\Command->execute() /media/bravo/Development/website/bitbucket/website/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:241
PHP   8. Fdw\Core\Console\SetupCommand->fire() /media/bravo/Development/website/bitbucket/website/vendor/laravel/framework/src/Illuminate/Console/Command.php:108
PHP   9. Fdw\Core\Console\SetupCommand->fireOtherPackages() /media/bravo/Development/website/bitbucket/website/workbench/fdw/core/src/Fdw/Core/Console/SetupCommand.php:34
PHP  10. Fdw\Core\Console\SetupCommand->fireTrackerPackage() /media/bravo/Development/website/bitbucket/website/workbench/fdw/core/src/Fdw/Core/Console/SetupCommand.php:80
PHP  11. Illuminate\Console\Command->call() /media/bravo/Development/website/bitbucket/website/workbench/fdw/core/src/Fdw/Core/Console/SetupCommand.php:91
PHP  12. Illuminate\Console\Command->run() /media/bravo/Development/website/bitbucket/website/vendor/laravel/framework/src/Illuminate/Console/Command.php:124
PHP  13. Symfony\Component\Console\Command\Command->run() /media/bravo/Development/website/bitbucket/website/vendor/laravel/framework/src/Illuminate/Console/Command.php:96
PHP  14. Illuminate\Console\Command->execute() /media/bravo/Development/website/bitbucket/website/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:241
PHP  15. Illuminate\Database\Console\Migrations\MigrateCommand->fire() /media/bravo/Development/website/bitbucket/website/vendor/laravel/framework/src/Illuminate/Console/Command.php:108
PHP  16. Illuminate\Database\Migrations\Migrator->run() /media/bravo/Development/website/bitbucket/website/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php:65
PHP  17. Illuminate\Database\Migrations\Migrator->runMigrationList() /media/bravo/Development/website/bitbucket/website/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:80
PHP  18. Illuminate\Database\Migrations\Migrator->runUp() /media/bravo/Development/website/bitbucket/website/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:109
PHP  19. CreateTrackerTables->up() /media/bravo/Development/website/bitbucket/website/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:133
PHP  20. PragmaRX\Tracker\Support\Database\Migrator->up() /media/bravo/Development/website/bitbucket/website/app/database/migrations/2014_06_11_040853_create_tracker_tables.php:16
PHP  21. PragmaRX\Tracker\Support\Database\Migrator->execute() /media/bravo/Development/website/bitbucket/website/vendor/pragmarx/tracker/src/Support/Database/Migrator.php:41
PHP  22. PragmaRX\Tracker\Support\Database\Migrator->createTables() /media/bravo/Development/website/bitbucket/website/vendor/pragmarx/tracker/src/Support/Database/Migrator.php:402
PHP  23. Illuminate\Database\Schema\Builder->create() /media/bravo/Development/website/bitbucket/website/vendor/pragmarx/tracker/src/Support/Database/Migrator.php:63
PHP  24. PragmaRX\Tracker\Support\Database\Migrator->PragmaRX\Tracker\Support\Database\{closure}() /media/bravo/Development/website/bitbucket/website/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php:110
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Call to undefined method PragmaRX\\Tracker\\Support\\Database\\Migrator::timestamp()","file":"\/media\/bravo\/Development\/website\/bitbucket\/website\/vendor\/pragmarx\/tracker\/src\/Support\/Database\/Migrator.php","line":61}}

GeoIP

Would love to use the GeoIP but I can't get it to work on Windows. Or is this impossible?

Migration error on linux

Hey Antonio, sorry for spoiling Australia - Netherlands with an issue :) oh, the orange just did 2:2...
Anyway, I was just checking out this perfect package of yours in one of my laravel installations and it seems it runs perfectly on windows.
So I wanted to check it out on my production system (linux), too.
However I get the following error:

[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: SQLSTATE[42000]: 
Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes 
(SQL: alter table `tracker_devices` add unique tracker_devices_kind_model_platform_platform_version_unique(`kind`, `model`, `platform`, `platform_version`)))

It seems that it could be related with MyIsam. It should not be an issue on InnoDb.

My environment variables are:
PHP Version 5.5.10
MySQL Version 5.5.35

I just read that InnoDb should be standard from mysql 5.5 onwards.
I do not see that I selected MyIsam somewhere explicitly in the database.

do you have any idea how to fix this (if it is fixable on your side) ?

Or might something else be the cause of this?

best,
Marco.

Defect: error when firing en event without payload parameter

I have found an error that happens when we fire an event without provide the payload parameter, Tracker is not able to find the argument.

Error:
[2014-08-04 22:12:01] development.ERROR: exception 'ErrorException' with message 'Missing argument 1 for PragmaRX\Tracker\Vendor\Laravel\ServiceProvider::PragmaRX\Tracker\Vendor\Laravel{closure}()' in //vendor/pragmarx/tracker/src/Vendor/Laravel/ServiceProvider.php:439

When firing an Event without provide the payload, ex:
\Event::fire('my.event');

Laravel assumes an empty array as default payload value:
file: vendor/laravel/framework/Illuminate/Events/Dispatcher.php
line: public function fire($event, $payload = array(), $halt = false)

This empty array causes Tracker to return an error at:
file: vendor/pragmarx/tracker/src/Vendor/Laravel/ServiceProvide.php
inside method: private function registerGlobalEventLogger()
line: $this->app['events']->listen('*', function($object) use ($me)

To resolve the problem, I have modified the line to:
$this->app['events']->listen('*', function($object=null) use ($me)

Please, validate and apply permanent fix.

Thank you,

Robson Martins

1054 Unknown column 'total' in 'order clause'' ?

I am pretty new to laravel so forgive me if this all is just silly to ask.. I am using mysql database. The site template and such looks great! Able to see all of the info except events and errors (they are in teh database, however). A lot of errors like this when I try to view the pages.

Next exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'total' in 'order clause' (SQL: select count(*) as aggregate from (select '1' as row from tracker_events inner join tracker_events_log on tracker_events_log.event_id = tracker_events.id where tracker_events_log.updated_at >= 2014-12-26 23:38:41 and tracker_events_log.updated_at <= 2014-12-27 23:38:41 group by tracker_events.id, tracker_events.name order by total desc) AS count_row_table)' in /laravel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:625

I am getting this. I am unsure why it's claiming to be missing the "total" column. I re-built the migration tables and it all works fine, except that. Any clues?

It does not assume the connection configuredon the config.php

Hey Antonio,

Awesome work, thank you.

So, if you configure a separated database/connection for tracker and configure on the config.php, it works, for migration, it assumes the customized connection, however, when it try to track something, it assumes the default connection and not the customized one.

My workaround was to create the tables on the database from my default connection, however I would like to have tracker on a separated schema.

Thank you.

Robson.

The installation is smooth, but i just can't get any track data

My app is being developed in local environment, I noticed the several options should be enabled in config.php, but I just can't get it to work to show anything.

My controller code:
public function show($id){

    $post=Post::with('category')->findOrFail($id);

    $rootmenus = Menu::roots()->get();

    $views=Tracker::logByRouteName('posts.show')
        ->where(function($query)
        {
            $query
                ->where('parameter', 'id')
                ->where('value', '$id');
        })
        ->count();

    //dd($views);
    return View::make('front.posts.show',compact('post','rootmenus','views'));
}

$views always show 0..

Don't get it working on Laravel 4.2

I installed the Package on my Laravel 4.2 System, but as soon as I enable it "'enabled' => true,"
I get the following error: "Call to a member function connection() on a non-object".

Can't really find the cause and a solution to get it working.

Would be cool if you could help me out there.

Incompatible with most recent version of SB Admin 2

Hi,

I noticed that the commands for downloading SB Admin 2 in your installation guide reference an old location that no longer exists. I downloaded the most recent version from their website (http://startbootstrap.com/template-overviews/sb-admin-2/) but the file names for the included JQuery library and font awesome css filles have changed slightly in the newer version, which breaks the stats views.

The references to these files would ideally be customizable in the config for Tracker I think, but do you know which version of SB Admin 2 you built the views around as a fix for now?

Laravel v4.2.8 installation error

Hi,

After i insert this line in app/config.php
'PragmaRX\Tracker\Vendor\Laravel\ServiceProvider',

I got "error in exception handler" in cmd, php artisan tracker:tables

OS: Windows 7
Framework: Laravel 4.2.8 fresh install

Broken link for sb-admin

The link provided to download sb-admin is broken.

I tried downloading it from the original site but the references in your template are to a completely different version.

Could you please update the link.

Using database driver for Sessions

When I switched over my sessions to use the database and ran the migration. I get this error when ever I go to my website:

Error in exception handler: Tracker: Model not found for 'session_model'. in /media/bravo/Development/foxdigitalweb/bitbucket/foxdigitalweb/vendor/pragmarx/tracker/src/Vendor/Laravel/ServiceProvider.php:394

Does this mean I need to actually create the Model for it? I thought that was not needed.

PHP Parse error

Hi :)

I'm trying to install your tracker, however, I'm getting a PHP Parse error when doing a composer update:

Error Output: PHP Parse error: parse error in [...]/vendor/pragmarx/support/src/helpers.php on line 767

I'm running Laravel 4.2.

regards, quo

No tables are being logged to except for the tracker_sessions table

I went through the guide for installing tracker, but for some reason the only table being logged to is tracker_sessions.

I enabled all of trackers logging features, demonstrated in the config file below. I have tried adding all tables to my applications database and creating a separate database just for tracker. Both of these configurations are yielding the same results. No matter how I change my configuration the only table being written to is the tracker_sessions table.


/app/vendor/pragmarx/tracker/src/config/config.php

true, /** * Robots should be tracked? */ 'do_not_track_robots' => true, /** * Which environments are not trackable? */ 'do_not_track_environments' => [ // defaults to none ], /** * Which routes names are not trackable? */ 'do_not_track_routes' => [ 'tracker.stats.*', ], /** * The Do Not Track Ips is used to disable Tracker for some IP addresses: * * '127.0.0.1', '192.168.1.1' * * You can set ranges of IPs * '192.168.0.1-192.168.0.100' * * And use net masks * '10.0.0.0/32' * '172.17.0.0/255.255.0.0' */ 'do_not_track_ips' => [ '127.0.0.0/24' /// range 127.0.0.1 - 127.0.0.255 ], /** * Log every single access? * * The log table can become huge if your site is popular, but... * * Log table is also responsible for storing information on: * * - Routes and controller actions accessed * - HTTP method used (GET, POST...) * - Error log * - URL queries (including values) */ 'log_enabled' => true, /** * Log SQL queries? * * Log must be enabled for this option to work. */ 'log_sql_queries' => true, /** * If you prefer to store Tracker data on a different database or connection, * you can set it here. * * To avoid SQL queries log recursion, create a different connection for Tracker, * point it to the same database (or not) and forbid logging of this connection in * do_not_log_sql_queries_connections. */ 'connection' => 'tracker', /** * Forbid logging of SQL queries for some connections. * * To avoid recursion, you better ignore Tracker connection here. * * Please create a separate database connection for Tracker. It can hit * the same database of your application, but the connection itself * has to have a different name, so the package can ignore its own queries * and avoid recursion. * */ 'do_not_log_sql_queries_connections' => [ 'tracker' ], /** * Also log SQL query bindings? * * Log must be enabled for this option to work. */ 'log_sql_queries_bindings' => true, /** * Log events? */ 'log_events' => true, /** * Which events do you want to log exactly? */ 'log_only_events' => [ // defaults to logging all events ], /** * What are the names of the id columns on your system? * * 'id' is the most common, but if you have one or more different, * please add them here in your preference order. */ 'id_columns_names' => [ 'id' ], /** * Do not log events for the following patterns. * Strings accepts wildcards: * * eloquent.* * */ 'do_not_log_events' => [ 'illuminate.log', 'eloquent.*', 'router.*', 'composing: *', 'creating: *', ], /** * Do you wish to log Geo IP data? * * You will need to install the geoip package * * composer require "geoip/geoip":"~1.14" * * And remove the PHP module * * sudo apt-get purge php5-geoip * */ 'log_geoip' => true, /** * Do you wish to log the user agent? */ 'log_user_agents' => true, /** * Do you wish to log your users? */ 'log_users' => true, /** * Do you wish to log devices? */ 'log_devices' => true, /** * Do you wish to log HTTP referers? */ 'log_referers' => true, /** * Do you wish to log url paths? */ 'log_paths' => true, /** * Do you wish to log url queries and query arguments? */ 'log_queries' => true, /** * Do you wish to log routes and route parameters? */ 'log_routes' => true, /** * Log errors and exceptions? */ 'log_exceptions' => true, /** * A cookie may be created on your visitor device, so you can have information * on everything made using that device on your site. * */ 'store_cookie_tracker' => true, /** * If you are storing cookies, you better change it to a name you of your own. */ 'tracker_cookie_name' => 'please_change_this_cookie_name', /** * Internal tracker session name. */ 'tracker_session_name' => 'tracker_session', /** * ** IMPORTANT ** * Change the user model to your own. */ 'user_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\User', /** * You can use your own model for every single table Tracker has. */ 'session_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Session', 'log_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Log', 'path_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Path', 'query_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Query', 'query_argument_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\QueryArgument', 'agent_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Agent', 'device_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Device', 'cookie_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Cookie', 'domain_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Domain', 'referer_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Referer', 'route_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Route', 'route_path_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\RoutePath', 'route_path_parameter_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\RoutePathParameter', 'error_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Error', 'geoip_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\GeoIp', 'sql_query_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQuery', 'sql_query_binding_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQueryBinding', 'sql_query_binding_parameter_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQueryBindingParameter', 'sql_query_log_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SqlQueryLog', 'connection_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Connection', 'event_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\Event', 'event_log_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\EventLog', 'system_class_model' => 'PragmaRX\Tracker\Vendor\Laravel\Models\SystemClass', /** * Laravel internal variables on user authentication and login. */ 'authentication_ioc_binding' => 'auth', // defaults to 'auth' in Illuminate\Support\Facades\Auth 'authenticated_check_method' => 'check', // to Auth::check() 'authenticated_user_method' => 'user', // to Auth::user() 'authenticated_user_id_column' => 'id', // to Auth::user()->id 'authenticated_user_username_column' => 'email', // to Auth::user()->email /** * Laravel Alias, create one? Which name? */ 'create_tracker_alias' => true, 'tracker_alias' => 'Tracker', /** * Enable the Stats Panel? */ 'stats_panel_enabled' => true, /** * Stats Panel routes before filter * * You better drop an 'auth' filter here. */ 'stats_routes_before_filter' => '', /** * Stats Panel template path */ 'stats_template_path' => '/templates/sb-admin-2', /** * Stats Panel base uri. * * If your site url is http://wwww.mysite.com, then your stats page will be: * * http://wwww.mysite.com/stats * */ 'stats_base_uri' => 'stats', /** * Stats Panel layout view */ 'stats_layout' => 'pragmarx/tracker::layout', /** * Stats Panel controllers namespace */ 'stats_controllers_namespace' => 'PragmaRX\Tracker\Vendor\Laravel\Controllers', ``` ];

Tracker and Zizaco confide

Hi,

I've just installed your package and it looks good. The main issue I got is that nothing is logged to DB.

I've got no errors or anything like that...
In tracker config file I've edited user model to
'user_model' => 'Zizaco\Confide\Zizaco\Confide\ConfideUser',

but it didn't helped... I've enabled logging in config, this is my config
http://laravel.io/bin/YJPbd

running migration errors

this is all the errors I got running the migration

[admin@Administrators-iMac baas-platform (develop)]$ a migrate

[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1170 BLOB/TEXT column 'path' used in key specification without a key length (SQL
: alter table tracker_paths add index tracker_paths_path_index(path))

migrate [--bench[="..."]] [--database[="..."]] [--path[="..."]] [--package[="..."]] [--pretend] [--seed]

[admin@Administrators-iMac baas-platform (develop)]$ a migrate

[Illuminate\Database\QueryException]
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'tracker_log' already exists (SQL: create table tracker_log (id
int unsigned not null auto_increment primary key, session_id int unsigned not null, path_id int unsigned not null, query_id i
nt unsigned null, method varchar(10) not null, route_path_id int unsigned null, is_ajax tinyint(1) not null, is_secure tiny
int(1) not null, is_json tinyint(1) not null, wants_json tinyint(1) not null, error_id int unsigned null, created_at timest
amp default 0 not null, updated_at timestamp default 0 not null) default character set utf8 collate utf8_unicode_ci)

migrate [--bench[="..."]] [--database[="..."]] [--path[="..."]] [--package[="..."]] [--pretend] [--seed]

[admin@Administrators-iMac baas-platform (develop)]$ a migrate

[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1170 BLOB/TEXT column 'path' used in key specification without a key length (SQL
: alter table tracker_paths add index tracker_paths_path_index(path))

migrate [--bench[="..."]] [--database[="..."]] [--path[="..."]] [--package[="..."]] [--pretend] [--seed]

[admin@Administrators-iMac baas-platform (develop)]$ a migrate

[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table
tracker_devices add unique tracker_devices_kind_model_platform_platform_version_unique(kind, model, platform, platform_ver sion))

migrate [--bench[="..."]] [--database[="..."]] [--path[="..."]] [--package[="..."]] [--pretend] [--seed]

[admin@Administrators-iMac baas-platform (develop)]$ a migrate

[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1170 BLOB/TEXT column 'referer' used in key specification without a key length (
SQL: alter table tracker_referers add index tracker_referers_referer_index(referer))

migrate [--bench[="..."]] [--database[="..."]] [--path[="..."]] [--package[="..."]] [--pretend] [--seed]

[admin@Administrators-iMac baas-platform (develop)]$ a migrate

[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1170 BLOB/TEXT column 'referer' used in key specification without a key length (
SQL: alter table tracker_referers add index tracker_referers_referer_index(referer))

Install guide

An install guide in the readme would be really helpful

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.