Daandelange / kirby3-simplestats

All your data are belong to us. -- Track pageviews, referrers and devices on your Kirby 3 website.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

.sqlite

possible-is opened this issue · comments

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

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 !

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

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

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.)

  • 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) to ensure if data gets collected or not.
db tables that should be there : (and some/all filled with rows)
image

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.

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

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.

:)
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...

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. :)

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

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

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)

Hey Matthias, any updates on this ?