Daandelange / kirby3-simplestats

All your data are belong to us. -- Track pageviews, referrers and devices on your Kirby 3 website.
MIT License
62 stars 7 forks source link

.sqlite #7

Closed possible-is closed 1 year ago

possible-is commented 3 years ago

Dear Daan, i was very happy to read about your plugin in the last kirby kosmos issue and installed it right away. Judging from the panel the plugin seems to work there, but there is no .sqlite file being created in the site folder (site/logs/simplestats.sqlite), in fact, no logs folder has been created and the panel view states: "Unable to open database: unable to open database file". So there seems one part not working as expected. Do i have to create the folder site/logs and the files there myself or is this automatically done by the plugin? Is there a way to troubleshoot this? I am running on kirby 3.4.0

Matthias

Daandelange commented 3 years ago

Hello, Matthias, Thanks for testing.

I don't know the minimum Kirby version yet. I've started writing this plugin before Kirby 3.4 but a big part of it has been written with Kirby 3.5. If anything is uncompatible, it should be quite easy to fix.

The site/logs folder should be created automatically, but you can try to manually create the folder. In it, simplestats.sqlite is the db file, simplestats_errors.txt holds silent errors / notices related to simplestats' inner mechanics (enabled by default). Db creation errors are logged there, if there's nothing, it probably crashes somewhere before/early. (view code)
For troubleshooting, I'd say, first get the tracking part right; if that works, move on to the panel. Visit a page page ( /!\ by default, connected users are not tracked! ) with Kirby's debugging on, you should see more information.

I hope that helps, good luck !

possible-is commented 3 years ago

Dear Daan, indeed, it seems if i create a site/logs folder by hand, the .sqlite file is being created... i'll wait now for 24hrs to see if any tracking will happen... Thanks so far and with that i report the first bug: logs-folder is not being created automatically... :)

Matthias

Daandelange commented 3 years ago

Great! Fixed! If you have the panel enabled, simplestats' information tabs shows some raw instant tracking info. Referrers are also instant.

possible-is commented 3 years ago

hey daan,

seems something still doesnt work. i’ve installed the plugin on 2 domains yesterday morning, so today there should be something showing up. domain 1 has a .sqlite file (53KB) and an error log:

[2021-01-18 09:57] [Warning ] refererStats(globalStats) : db error =SQLSTATE[HY000]: General error: 1 no such column: medium [2021-01-18 09:57] [Warning ] refererStats(mediumStats) : db error =SQLSTATE[HY000]: General error: 1 no such column: medium [2021-01-18 09:57] [Warning ] refererStats(mediumStatsOverTime) : db error =SQLSTATE[HY000]: General error: 1 no such column: medium [2021-01-18 09:57] [Warning ] refererStats(domainRecentStats) : db error =SQLSTATE[HY000]: General error: 1 no such column: medium [2021-01-18 09:57] [Warning ] refererStats(AllDomainStats) : db error =SQLSTATE[HY000]: General error: 1 no such column: medium [2021-01-18 09:57] [Warning ] refererStats(globalStats) : db error =SQLSTATE[HY000]: General error: 1 no such column: medium [2021-01-18 09:57] [Warning ] refererStats(mediumStats) : db error =SQLSTATE[HY000]: General error: 1 no such column: medium [2021-01-18 09:57] [Warning ] refererStats(mediumStatsOverTime) : db error =SQLSTATE[HY000]: General error: 1 no such column: medium [2021-01-18 09:57] [Warning ] refererStats(domainRecentStats) : db error =SQLSTATE[HY000]: General error: 1 no such column: medium [2021-01-18 09:57] [Warning ] refererStats(AllDomainStats) : db error =SQLSTATE[HY000]: General error: 1 no such column: medium [2021-01-19 10:53] [Warning ] refererStats(globalStats) : db error =SQLSTATE[HY000]: General error: 1 no such column: medium [2021-01-19 10:53] [Warning ] refererStats(mediumStats) : db error =SQLSTATE[HY000]: General error: 1 no such column: medium [2021-01-19 10:53] [Warning ] refererStats(mediumStatsOverTime) : db error =SQLSTATE[HY000]: General error: 1 no such column: medium [2021-01-19 10:53] [Warning ] refererStats(domainRecentStats) : db error =SQLSTATE[HY000]: General error: 1 no such column: medium [2021-01-19 10:53] [Warning ] refererStats(AllDomainStats) : db error =SQLSTATE[HY000]: General error: 1 no such column: medium

domain 2 has only a .sqlite file (15KB)

both domains say in the panel: no data yet.

i have also installed matomo plugin on both websites and there should be visitor data available…

mhhh. there is no other errors showing, so maybe i forgot someting? do i need to add any code to the templates for the tracking to work?

greetings, matthias


matthias@possible.is

www.possible.is www.possible-books.com www.menetekel.org

Am 18.01.2021 um 10:44 schrieb Daan de Lange notifications@github.com:

Great! Fixed! If you have the panel enabled, simplestats' information tabs shows some raw instant tracking info. Referrers are also instant.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Daandelange/kirby3-simplestats/issues/7#issuecomment-762124000, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA67FXITIYA7VMIL3TVIENLS2P7H7ANCNFSM4WG46E7A.

Daandelange commented 3 years ago

Hey, Regarding the errors, they should have been fixed by #9, did you install the latest version on both domains ?

No action should be required to enable tracking. (Soon there will be options to set for different tracking methods.)

So it seems like your db is empty, despite having different sizes. 53Kb should about be the size of an empty db. 15Kb sounds too small so maybe there was a problem creating it.
I'd say, try opening your db file with a SQLite viewer (I use this one) to ensure if data gets collected or not.
db tables that should be there : (and some/all filled with rows) image

possible-is commented 3 years ago

hey daan, thanks a lot. i have installed the latest version on one domain (kirby 3.5.0) and there was no errorlog written. in the panel, it is still empty (see attached image).

i then tested it like this:

  1. i erased the logs folder. this gave me this errormessage: Class 'daandelange\SimpleStats\Dir' not found
  2. i created the folder by hand again.
    • i have the frontend in safari open (not logged in) when i load the page, nothing happens
    • i reload the panel in chrome (logged in), the empty database file appears
  3. then i click around in safari to generate data, but the database file stays at 53KB.

I also opened the file in DB Browser and it has the structure from your image.

Seems like the plugin works but no visitor data seems to be written into the database…

greetings, matthias

Matthias Hübner

matthias@possible.is

www.possible.is www.possible-books.com www.menetekel.org

Am 19.01.2021 um 11:56 schrieb Daan de Lange notifications@github.com:

Hey, Regarding the errors, they should have been fixed by #9 https://github.com/Daandelange/kirby3-simplestats/issues/9, did you install the latest version on both domains ?

No action should be required to enable tracking. (Soon there will be options to set for different tracking methods.)

The information tab should instantly show some data, as well as the referrers tab, if you got referrer visits. Other (computed) data appears after 24H. If the panel shows "no data yet", it means that it succeeds in querying the database which returned 0 rows/data, so the panel communication with the plugin trough the API seems to be OK. So it seems like your db is empty, despite having different sizes. 53Kb should about be the size of an empty db. 15Kb sounds too small so maybe there was a problem creating it. I'd say, try opening your db file with a SQLite viewer (I use this one https://sqlitebrowser.org/) to ensure if data gets collected or not. db tables that should be there : (and some/all filled with rows) https://user-images.githubusercontent.com/1329784/105024260-2b92fe00-5a4c-11eb-99f7-3aed2ae4074d.png — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Daandelange/kirby3-simplestats/issues/7#issuecomment-762766127, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA67FXLTI2IQRPIUPP7TURDS2VQO7ANCNFSM4WG46E7A.

possible-is commented 3 years ago

hey daan, sorry for leaning in so heavily. i hope you’re not annoyed.

if there is a way to check why there is no incoming data in the future, please let me know. i would be very happy to use your plugin. when it works, it would be really super easy to use and perfect for some overview of how many people are actually visiting.

have a nice evening. matthias

Matthias Hübner

matthias@possible.is

www.possible.is www.possible-books.com www.menetekel.org

Am 19.01.2021 um 11:56 schrieb Daan de Lange notifications@github.com:

Hey, Regarding the errors, they should have been fixed by #9 https://github.com/Daandelange/kirby3-simplestats/issues/9, did you install the latest version on both domains ?

No action should be required to enable tracking. (Soon there will be options to set for different tracking methods.)

The information tab should instantly show some data, as well as the referrers tab, if you got referrer visits. Other (computed) data appears after 24H. If the panel shows "no data yet", it means that it succeeds in querying the database which returned 0 rows/data, so the panel communication with the plugin trough the API seems to be OK. So it seems like your db is empty, despite having different sizes. 53Kb should about be the size of an empty db. 15Kb sounds too small so maybe there was a problem creating it. I'd say, try opening your db file with a SQLite viewer (I use this one https://sqlitebrowser.org/) to ensure if data gets collected or not. db tables that should be there : (and some/all filled with rows) https://user-images.githubusercontent.com/1329784/105024260-2b92fe00-5a4c-11eb-99f7-3aed2ae4074d.png — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Daandelange/kirby3-simplestats/issues/7#issuecomment-762766127, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA67FXLTI2IQRPIUPP7TURDS2VQO7ANCNFSM4WG46E7A.

Daandelange commented 3 years ago

Hey Matthias, No worries, I'm happy that you try the plugin so let's figure this out ! The steps you took look OK. Note : the image 2 posts above was not uploaded via email.

It's possible to debug, but to be honest I have no idea what's wrong. I'm surprised that there's nothing relevant written to the log. Did you try enabling Kirby debugging to see if any errors are thrown there ? Also, in the database file, do you see any entries ? (in the pagevisitors table for example) image

I'll soon push some more changes and features, with some small fixes, it will be worth trying that.

Daandelange commented 3 years ago

Ok, new changes pushed, maybe it will randomly fix your issue. The information tab now also shows some debug information, which might help.

possible-is commented 3 years ago

hey daan,

i just installed it, and while now i seem to get a lot of feedback, it also seems to work less than before :)

i have attached the screenshots after copying the new plugin and deleting the sqlite file in site/logs.

the new .sqlite file is only 12 KB and has less structure than the one before. i also attached the error.log…

Bildschirmfoto 2021-01-21 um 21 43 34 Bildschirmfoto 2021-01-21 um 21 43 41 Bildschirmfoto 2021-01-21 um 21 44 06 Bildschirmfoto 2021-01-21 um 21 44 17

Errorlog:

[2021-01-21 21:37] [Tracking] Error tracking page: home. Error=Call to a member function code() on null [2021-01-21 21:37] [Warning] Error selecting visitors from DB while syncing stats. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:37] [Warning] Could not select existing visitor. Aborting tracking. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:37] [Warning] Error selecting visitors from DB while syncing stats. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:37] [Warning] Could not select existing visitor. Aborting tracking. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:38] [Warning] Error selecting visitors from DB while syncing stats. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:38] [Warning] Could not select existing visitor. Aborting tracking. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:38] [Warning] Error selecting visitors from DB while syncing stats. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:38] [Warning] Could not select existing visitor. Aborting tracking. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:38] [Warning] Error selecting visitors from DB while syncing stats. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:38] [Warning] Could not select existing visitor. Aborting tracking. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:38] [Warning] Error selecting visitors from DB while syncing stats. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:38] [Warning] Could not select existing visitor. Aborting tracking. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:39] [Warning] Error selecting visitors from DB while syncing stats. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:39] [Warning] Could not select existing visitor. Aborting tracking. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:39] [Warning] Error selecting visitors from DB while syncing stats. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:39] [Warning] Could not select existing visitor. Aborting tracking. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:40] [Warning] Error selecting visitors from DB while syncing stats. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:40] [Warning] Could not select existing visitor. Aborting tracking. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:40] [Warning] Error selecting visitors from DB while syncing stats. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:40] [Warning] pageStats(visitsOverTime) : db error =SQLSTATE[HY000]: General error: 1 no such table: pagevisits [2021-01-21 21:40] [Warning] pageStats(pageVisitsOverTime) : db error =SQLSTATE[HY000]: General error: 1 no such table: pagevisits [2021-01-21 21:41] [Notice] UPGRADE from db v1 to v2+ COMPLETE ! [2021-01-21 21:41] [Verbose] Upgrade : Versions are identical :) [2021-01-21 21:41] [Warning] refererStats(globalStats) : db error =SQLSTATE[HY000]: General error: 1 no such table: referers [2021-01-21 21:41] [Warning] refererStats(mediumStats) : db error =SQLSTATE[HY000]: General error: 1 no such table: referers [2021-01-21 21:41] [Warning] refererStats(mediumStatsOverTime) : db error =SQLSTATE[HY000]: General error: 1 no such table: referers [2021-01-21 21:41] [Warning] refererStats(domainRecentStats) : db error =SQLSTATE[HY000]: General error: 1 no such table: referers [2021-01-21 21:41] [Warning] refererStats(AllDomainStats) : db error =SQLSTATE[HY000]: General error: 1 no such table: referers [2021-01-21 21:41] [Warning] Error selecting visitors from DB while syncing stats. Error=SQLSTATE[HY000]: General error: 1 no such table: pagevisitors [2021-01-21 21:41] [Warning] pageStats(visitsOverTime) : db error =SQLSTATE[HY000]: General error: 1 no such table: pagevisits [2021-01-21 21:41] [Warning] pageStats(pageVisitsOverTime) : db error =SQLSTATE[HY000]: General error: 1 no such table: pagevisits

Daandelange commented 3 years ago

I still cannot see your images.
The update reports success but some tables are missing from the db... so weird !
What if you delete the database file and let it create a new one ?
Also, I updated the plugin again, fixes some single-language website issues, might be related to this.

possible-is commented 3 years ago

:) so, i first repaired this image mess above. you can now see the screens i wanted to send you in the previous comment.

i just installed the newest version, and this seems to work fine in establishing the database. however, everytime i open the first Page Visits page, i get this error: Call to a member function code() on null

i have surfed the site with safari not being logged in, but the sqlite file never gets updated (its 61KB now). seems like there is still no visits being recorded.

i have installed it on a complex kirby site, with no results. the error log states only: [2021-01-22 19:46] [Notice] Successfully created a new SimpleStats database v_2 @ [site path] /site/config/../logs/simplestats.sqlite !

now i also installed it on a fresh starterkit with no other interference, and i get no tracking either, but a different error log:

[2021-01-22 19:54] [Tracking] Error tracking page: notes. Error=File "[site path...] /site/plugins/simplestats/vendor/snowplow/referer-parser/php/src/Snowplow/RefererParser/../../../data/referers.json" does not exist(file: [site path...] /site/plugins/simplestats/vendor/snowplow/referer-parser/php/src/Snowplow/RefererParser/Exception/InvalidArgumentException.php#L10)

[2021-01-22 19:54] [Tracking] Error tracking page: photography. Error=File "[site path...] /site/plugins/simplestats/vendor/snowplow/referer-parser/php/src/Snowplow/RefererParser/../../../data/referers.json" does not exist(file: [site path...] /site/plugins/simplestats/vendor/snowplow/referer-parser/php/src/Snowplow/RefererParser/Exception/InvalidArgumentException.php#L10)

[2021-01-22 19:54] [Tracking] Error tracking page: about. Error=File "[site path...] /site/plugins/simplestats/vendor/snowplow/referer-parser/php/src/Snowplow/RefererParser/../../../data/referers.json" does not exist(file: [site path...] /site/plugins/simplestats/vendor/snowplow/referer-parser/php/src/Snowplow/RefererParser/Exception/InvalidArgumentException.php#L10)

[2021-01-22 19:54] [Tracking] Error tracking page: home. Error=File "[site path...] /site/plugins/simplestats/vendor/snowplow/referer-parser/php/src/Snowplow/RefererParser/../../../data/referers.json" does not exist(file: [site path...] /site/plugins/simplestats/vendor/snowplow/referer-parser/php/src/Snowplow/RefererParser/Exception/InvalidArgumentException.php#L10)

[2021-01-22 19:54] [Tracking] Error tracking page: photography. Error=File "[site path...] /site/plugins/simplestats/vendor/snowplow/referer-parser/php/src/Snowplow/RefererParser/../../../data/referers.json" does not exist(file: [site path...] /site/plugins/simplestats/vendor/snowplow/referer-parser/php/src/Snowplow/RefererParser/Exception/InvalidArgumentException.php#L10)

[2021-01-22 19:54] [Tracking] Error tracking page: notes. Error=File "[site path...] /site/plugins/simplestats/vendor/snowplow/referer-parser/php/src/Snowplow/RefererParser/../../../data/referers.json" does not exist(file: [site path...] /site/plugins/simplestats/vendor/snowplow/referer-parser/php/src/Snowplow/RefererParser/Exception/InvalidArgumentException.php#L10)

[2021-01-22 19:54] [Tracking] Error tracking page: about. Error=File "[site path...] /site/plugins/simplestats/vendor/snowplow/referer-parser/php/src/Snowplow/RefererParser/../../../data/referers.json" does not exist(file: [site path...] /site/plugins/simplestats/vendor/snowplow/referer-parser/php/src/Snowplow/RefererParser/Exception/InvalidArgumentException.php#L10)

i have changed the sites path to not make it public...

Daandelange commented 3 years ago

Thanks for these screenshots, they helped me fix a bunch of mistakes. I also forgot to test the single-lang panel view, which should work now. If you update simplestats and delete the database file again, it should either work or show some next errors. :)

possible-is commented 3 years ago

hello daan, i’ve uploaded the new version and all seems quiet now :) how can i definately check if there is any successful recording before the 24h run? the database should be written whenever someone visits?

matthias

possible-is commented 3 years ago

Hey Daan, i just checked both installs of the plugin (plainkit and complex website) and both still say "No Data Yet". Its 24hrs since i installed, so there should be something.

The error log for the complex site only states this: [2021-01-23 21:02] [Notice] Successfully created a new SimpleStats database v_2 @ /homepages/2/d771287486/htdocs/live/site/logs/simplestats.sqlite !

The plainkit as well: [2021-01-23 21:00] [Notice] Successfully created a new SimpleStats database v_2 @ /usr/www/users/relates/lab/trackingtest/site/logs/simplestats.sqlite !

Do you have an idea how i can test further why there is no tracking?

Matthias

possible-is commented 3 years ago

I could give you an FTP access to the plainkit site, so you can see yourself, if you want.

Daandelange commented 3 years ago

Hey Matthias, I guess there's still no tracking happening ? To instantly check what's happening, there's a visitors table in the information tab which should be filled as soon as a visitor is tracked. Referrers are also instantly shown. Before trying over FTP, could you try var_dump()ing some info in hooks.php's conditions, to figure out which ones are taken ? As any tracking error should be reported, it has to be the surrounding conditions that are not taken correctly. Also, if you are using kirby cache, try disabling it, I have not tested behaviour with caching enabled yet. (it should work, but you never know)

possible-is commented 3 years ago

hey daan, i just checked and indeed i am getting tracking on the starterkit kirby. on the already finished website with other plugins, there is no data yet somehow.

so, now i will check with the starterkit and the plugins of the other site if there is any interference. both sites have only one language, so i can rule that out already. lets see, i keep you posted…

matthias

Daandelange commented 3 years ago

Hey Matthias, any updates on this ?

possible-is commented 3 years ago

Not yet. My year so far has been dominated by corona and my little daughter :) i hope i can return to normal working schedules this autumn…

greetings, matthias

Matthias Hübner

@.***

www.possible.is www.possible-books.com www.menetekel.org

Am 16.08.2021 um 15:19 schrieb Daan de Lange @.***>:

Hey Matthias, any updates on this ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Daandelange/kirby3-simplestats/issues/7#issuecomment-899503833, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA67FXMLK42M4DJAMYBKX2TT5EF47ANCNFSM4WG46E7A. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.