Giter Club home page Giter Club logo

ads-statistics's Introduction

ads-statistics

Audit/Error Logging Module for Laravel

The module will track the page view history for all users of the associated website. The module will log 500 error statistics to help with debugging code. Additionaly, the posted data for form submission will be saved in the database. The settings file has an array option that allows you to remove sensitive files from being saved in the tracking table.

Once configired, this plugin will automatically save page viewing history to the database.

(Make sure to run "php artisan migrate" if updating)

Step 1:

Set up composer, add the package to your require tag:

composer require ads/statistics

Step 2:

Publish and run migrations:

php artisan vendor:publish --provider=Ads\\Statistics\\StatisticsServiceProvider
php artisan migrate

Step 3:

Add Statistic logging to 'web' middleware in app\Http\Kernel.php:

    protected $middlewareGroups = [
        'web' => [
            ...
            \Ads\Statistics\Statistic::class,
        ],

Step 4:

In order to log 500 errors, you'll need to add some code to the app/Exceptions/Handler.php Add this interceptor to the register function Add to or create the report function before the return:

public function register()
{
	$this->reportable(function (Throwable $e) {
	    //
	});

	$this->reportable(function (\Exception $e) {
	    \Statistic::error($e);
	});
}

* Step 5 is only necessary if you have user authentication

Step 5:

Edit the config/statistics.php file.

Please enter the column names from your user database table.

For example:

  'user_id' => 'email',
  'first_name' => 'first_name',
  'last_name' => 'last_name',
  'protected_fields' => ['password'],

ads-statistics's People

Contributors

dylan-dpc avatar scs-ben avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

ads-statistics's Issues

Variables not instantiated properly

On src/Ads/Statistics/Statistic.php lines 22, 52 85
"if (!is_object($statistic))" will throw an error if a cookie does not exist because $statistic is not instantiated in the scope. To solve the problem place "$statistic = NULL;" at the top of httpError() fatalError() and logStatistics()

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.