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

Page section blueprint : broken and js error thrown

boguscode opened this issue · comments

Hi,

got simplestats up and running to some extend, but when I try to implement the statistics in one of my blueprints, it throws this error, when I enter that particular blueprint in the panel

Cannot read properties of undefined (reading 'length')

My Blueprint uses tabs and goes like this:

title: MySite


tabs:
  stats:
    label: Stats
    icon: globe
    sections:
      pagestats:
        type: pagestats
        label: TestHeadline
        size: small
        showTotals: true
        showTimeline: true
        showLanguages: true
        showFullInfo: true

  content:
    label: Content
    icon: text
    columns:
      - width: 1/3
        fields:
          titlebar:
            label: Website Title
            type: text
          line1:
            type: line

I also enabled the panel view in my config php like this:

require_once(__DIR__ . '/../plugins/simplestats/src/models/SimpleStatsTimeFrameUtility.php');
return [
  // [...] your options ...

  // Simplestats
  'daandelange.simplestats.panel.enable' => true, // Disable the panel view completely
  'daandelange.simplestats.tracking.enableReferers' => true, // Disable referer tracking
  'daandelange.simplestats.tracking.timeFrameUtility' => new \daandelange\SimpleStats\SimpleStatsTimeFrameUtilityWeekly(), // Here you can put your custom inherited class from SimpleStatsTimeFrameUtility
  'daandelange.simplestats.tracking.timeFrameUtility' => 'weekly', // Alternative
  'daandelange.simplestats.tracking.method' => \daandelange\SimpleStats\SimpleStatsTrackingMode::OnImage,
];

can somebody give me a hint on what's wrong there?

Hi, this is not a configuration mistake but a bug, I think it has been fixed in 4bae997, are you using master ?

My page blueprint stats tab is identical to yours, it looks correct.

yes, 0.6.2-beta from the release page. Are the code changes already in there?

There have quite some changes since 0.6.2, while no release recently (gotta make one), you could try the master zip meanwhile.

I tried master to no avail. the error keeps popping up :(

Sorry, I'm unable to reproduce the error, even with an empty database... could you show me the line from which the error is thrown from ? (the corresponding somevar.length and parts around it)

I also tried deleting the db and starting anew. No luck.

from where do I get the somevar.length information you'll need? I'm not a programmer unfortunately.
The eroor pops up in my panel.

Bildschirmfoto 2023-05-04 um 10 42 19

If you want to try :

  1. Open the developer tools of your browser.
  2. In the console area, locate the error that is shown on your screenshot, it will have a link to a file and a line. Click on it.
  3. Try to prettify that minimised code so it's easier to read using the {} button below the code viewer.
  4. Take screenshot of the code area. (you might need to click once again on the file link to highlight the correct line)

there's a hole bunch of files involved

Bildschirmfoto 2023-05-04 um 12 29 19

Sorry, I didn't specify : you need the first one ;)

It points me to this:

}, [t._v(t._s(t.$t("simplestats.visits.languagesovertime")))]), t.visitsOverTime.length > 0 ? s("area-chart", { attrs: { data: t.visitsOverTime, download: !0, download: "PageVisitsOverTime.png", xtitle: t.$t("simplestats.charts.time"), ytitle: t.$t("simplestats.charts.visits"), height: this.sectionSize == "small" ? "240px" : this.sectionSize == "large" ? "280px" : this.sectionSize == "tiny" ? "120px" : "260px", library: t.chartOptions }

Ok, I see, I have a local fix for it, but I just came to realise that the page stats section is not working anymore, I need to add timeline features to it and move the old charts to the new common one. It's probably been broken for a while :s
I'll let you know when I have some progress on this.

Thanks so much for your support!

Bumping this, as it would be greatly increase its usefulness 😉

Hi! Is there a hot fix or a commit for this? Would love to try the plugin but can't get it to work because of the JS error... Thanks a lot!

Hello, sorry, no (hot)fix yet. I hope to address this somewhen soon.
This said, without using the page section, the plugin should work, so you can test it partially. ;)

looking forward to the fix as well, :) Thank you!

Hi, I just pushed a new version with some improvements on this side. It should work on multi-language websites, I didn't really have the time to test anything in depth. Feel free to try. ;)

As of v0.6.5 it also works correctly in mono language setups, but the layout is still a draft.

Here's how it looks using 2 different blueprint setups :

  • image
  • image

It could be of great use to me if you could post a screenshot of how it looks with your custom blueprints, to compare different use cases.