Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panel page widget not working for pages with custom URLs? #49

Open
jhogervorst opened this issue May 17, 2024 · 0 comments
Open

Panel page widget not working for pages with custom URLs? #49

jhogervorst opened this issue May 17, 2024 · 0 comments

Comments

@jhogervorst
Copy link

I'm using the matomo-page section in my Kirby v4 site with the latest version (2.0.1) of this plugin. Some of the pages have custom URLs, configured according to Kirby's documentation. The url() method on these pages is overridden to return the correct (custom) URL, as also instructed in your readme:

Matomo receives public urls, which means that its URIs are fetched once routes have been applied. Therefore, the plugin filters Matomo's responses with a uri created from the public url of the page. If you have set up custom routes, to skip subfolders for example, please make sure to overwrite the url method for the template with a page model, otherwise the uri won't be correct.

However, the widget is not working correctly. I notice the following error:

GET http://site/api/matomo-panel/get-page-metrics?period=month&multilang=false&overview=false&default=false&uri=/page

{
    "status": "error",
    "message": "Call to a member function url() on null",
    "code": 500,
    "exception": "Error",
    "key": null,
    "file": "/site/plugins/matomo/lib/matomo.php",
    "line": 171,
    "details": [],
    "route": "matomo-panel/get-page-metrics"
}

(In this case, /page is my custom URL, and the original URL would be something like /section/page.)

According to my debugging, the plugin tries to find the right page using $pages->find() with the custom URL:

$page = $site->childrenAndDrafts()->find($uri);

However, that method finds pages based on their ID, which is not equal to the (overridden/custom) URL.

I'm curious if something is wrong in my configuration, or this is a bug in the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant