arthurperton / statamic-popular

Other
0 stars 0 forks source link

It seems like page views are not stored #6

Open seebaermichi opened 6 months ago

seebaermichi commented 6 months ago

Bug description

I added Popular to this website: https://andy-besuch.com. The javascript is available and seems to work. If I check session storage in the browser pages are added to popular-entries. However the pageviews file in /storage/popular/ stays empty. Therefore no page views are shown in the dashboard.

If I run php artisan schedule:work locally (didn't try on production) it works and the storage/popular/pageviews is filled with data.

How to Reproduce

Steps to reproduce the behavior, for example:

  1. Go to https://andy-besuch.com
  2. Click on "Andy Besuch" to enter the website. Click a few links in the navigation.
  3. Check dev tools to see the session storage and you should see, that ids were added to popular-entries
  4. Unfortunately I can't share the empty storage/popular/pageviews file here.

Expected behavior

The storage/popular/pageviews file should include data about visited pages.

Environment

Application Name: Andy Besuch Laravel Version: 9.52.16 PHP Version: 8.1.27 Composer Version: 2.6.6 Environment: production Debug Mode: OFF URL: andy-besuch.com Maintenance Mode: OFF

Cache Config: NOT CACHED Events: NOT CACHED Routes: NOT CACHED Views: CACHED

Drivers Broadcasting: log Cache: statamic Database: mysql Logs: stack / single Mail: smtp Queue: sync Session: file

Statamic Addons: 1 Antlers: runtime Version: 3.3.58 Solo

Statamic Addons arthurperton/popular: 1.1.0

Install method for Statamic (choose one):

arthurperton commented 5 months ago

Please make sure you have the scheduler running in production too, typically by using a cronjob. This should solve your issue. If not, please feel free to reopen this issue.

seebaermichi commented 5 months ago

Please make sure you have the scheduler running in production too, typically by using a cronjob. This should solve your issue. If not, please feel free to reopen this issue.

Hi @arthurperton ,

thanks for you advice. But even with the scheduler running there are no page views, although there should be some due to the session storage of the browser.

Executing php artisan schedule:list on the server shows this: * * * * * php artisan popular:aggregate ...................... Next Due: 28 seconds from now

The storage/popular/pageviews file stays empty.

arthurperton commented 5 months ago

I am sorry to hear the problem persists for you, even with the scheduler apparently running. I reopened the issue. Here are some actions that might help solving it:

  1. Is there anything interesting in your log files that you can share?
  2. What happens if you run php please popular:aggregate from the command line on your server?
seebaermichi commented 5 months ago

Thanks for taking care of this again.

No, there are no log entries related to this issue.

If I'm running php please popular:aggregate I see: 1150 pageviews aggregated and in the dashboard I see suddenly a lot of page views, where before were none. So the command seems to work.

Is there any other information I could provide to help you get an idea of why there is not data?

arthurperton commented 5 months ago

Okay great so the command is working, at least from the command line. But something is not working for you when it is run from the scheduler. Maybe it has something to do with access rights, but that is just a guess. Best to have a look at your crontab logs for the output, see what goes wrong there.

thetemplateblog commented 2 months ago

It looks like I'm having the same issue. For the guy in the back, where are the scheduler logs stored?

I resolved this by creating a CRON job on the server to trigger php artisan schedule:run