Search Report for Statamic stores search logs within a database, even if the rest of your site is using flat files. If you don't want to setup a large database server, you may also use SQLite. For more information on how to configure a database connection, please consider checking out Laravel's Database: Getting Started page.
Regardless of which database engine you plan to use, you will need to first publish Search Report for Statamic's migration by running the following command:
Note: If you want to change the database table name, make sure to update the search_report.database.table
configuration option before running the following command.
1php artisan search-report:search-term-logs-table
A new file will be created for you within your site's database/migrations
folder.
By default, Search Report for Statamic will utilize your site's database.default
database connection. You can change this by updating the search_report.database.connection
configuration option. Once you have the database setup and configured for Search Report for Statamic you may run the following command to create your new database table:
1php artisan migrate
By default, Search Report for Statamic will not log searches made by authenticated users on your site. This can be changed by modifying the following configuration option within the config/search_report.php
configuration file:
1<?php 2 3return [ 4 5 // ... 6 7 /* 8 |-------------------------------------------------------------------------- 9 | Authenticated User Search Logging Configuration10 |--------------------------------------------------------------------------11 |12 | The 'Ignore Authenticated Users' option configures the logging of search13 | queries made by signed-in users. When enabled, it prevents the storage14 | of search activities from authenticated accounts. This can be useful15 | when the only authenticated users are administrators or editors.16 |17 */18 19 'ignore_authenticated_users' => true,20 21 // ...22 23];
The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.