sylvainjule / kirby-matomo Goto Github PK
View Code? Open in Web Editor NEWMatomo integration for Kirby, in both your panel and templates. Kirby 3 only.
License: MIT License
Matomo integration for Kirby, in both your panel and templates. Kirby 3 only.
License: MIT License
Hello there,
I notice this issue with the websites I'm working with. Separate hosting but same issue when this plugin is active, the cache folders doesn't create the static files cache although the folders does get created.
When I disable the plugin and run Matomo manually it's working.
Any ideas where that could come from?
When there is insufficient data to calculate a current number, the fields will often display a 'NaN' text - guessing that is because it's trying to do a 0-based division).
This makes the display look like an unintended error happened - not that there is still 'insufficient data' to provide a response... It would be immensely helpful if the plugin would trap those situations, and would provide a nicer message in the interface. ๐
Many developers using your plugin may already have affiliate links of their own to purchase a Kirby license. You can make it easy for anyone to contribute a little to your costs by adding a 'buy me a coffee' or 'buy me a beer' button in your docs, too! ๐
I have a clean installation of your Matomo plugin running on my webserver.
According to the documentation the tracking code should be loaded once the snippet was added to the site. However the code doesn't load. The same issue occurs when I set the option 'sylvainjule.matomo.active' => true
.
In my case I just removed the <?php if(Matomo::allowed()) : ?>
clause inside /lib/snippets/matomo.php
.
Might be a simple bug โ
Hello,
I have this fantastic plugin in a Kirby 3.7.2.1 installation
I have the dashboard in a tab in site.yml, fully working, like this:
analytics:
icon: chart
columns:
- width: 3/4
sections:
main:
type: matomo-main
- width: 1/4
sections:
sidebar:
type: matomo-sidebar
It shows data, and this data seems to match the one that I see at Matomo's own dashboard.
I also have a widget in a type of page, like this:
sections:
matomo:
type: matomo-page
period: year
overview: true
Both this type of page and its parent are always unlisted (not draft)
Matomo records visits to these pages, but not the widget:
Config options:
'sylvainjule.matomo.url' => 'https://xxxxxxxx.com/matomo',
'sylvainjule.matomo.id' => '3',
'sylvainjule.matomo.token' => 'xxxxxxxxxxxxxxxxxxxxx',
'sylvainjule.matomo.active' => true,
'sylvainjule.matomo.disableCookies' => true,
As you see I use cookie-less Matomo.
I have no routes in config.
How to troubleshoot this?
Thanks
Hi!
Since I have updated Matomo 3.6 to 4.2, only one widget (randomly) working.
For exemple here I only have the chart working :
This type of error showing up for 4 other calls :
error: "file_get_contents(https://mydomain.fr/?module=API&methth=mytoken&format=JSON&urls[0]=method%3DVisitsSummary.getVisits%26idSite%3D3%26period%3Dday%26date%3Dtoday&urls[1]=method%3DVisitsSummary.getVisits%26idSite%3D3%26period%3Dday%26date%3Dlast7&urls[2]=method%3DVisitsSummary.getVisits%26idSite%3D3%26period%3Dmonth%26date%3Dtoday&urls[3]=method%3DVisitsSummary.getVisits%26idSite%3D3%26period%3Dyear%26date%3Dtoday): failed to open stream: HTTP request failed! HTTP/1.1 429 Too Many Requests\r\n"
I have tested all the request individually and they are working.
Have you any clue about this error ?
Thanks
In the popularPages module I see the /blog page, but it's children are nowhere to be found.
Enabling the matomo-page module on the post blueprint always returns "There is no data to display".
If I check in Matomo's dashboard I can clearly see that the urls are being tracked correctly. Chrome's network inspector also shows me that the URL that is requestet in the matomo-page module is the correct, public, one but there never is any data.
Am I overlooking something?
Hello,
I installed the matomo on a subdomain https://matomo.monsite.com
When I connect to matomo everything is ok, however in the panel, the plugin does not seem to be able to connect.
The 3 factors are well fulfilled:
'sylvainjule.matomo.url' => 'https://matomo.monsite.com',
'sylvainjule.matomo.id' => '1',
'sylvainjule.matomo.token' => 'MYTOKEN',
'sylvainjule.matomo.trackUsers' => true,
'sylvainjule.matomo.disableCookies' => true,
My kirby settings are:
Kirby version: 3.9.1
PHP version: 8.1.6
Serveur: Apache
https://monsite.com/api/matomo-panel/ display:
{"status":"error","message":"No route found for path: "matomo-panel" and request method: "GET"","code":404,"key":null,"details":[]}
I don't understand what's wrong.
I couldn't get the built-in snippet to work in a site I'm building atm, and when I pasted the javascript snippet directly from Matomo, it worked. When comparing the 2, the only things I could notice different were
To be totally honest, not sure whether the change from 'piwik' to 'matomo' was the cause, but it's my best guess...
Once again, thank you SO MUCH for such a terrific plugin.
3.1. url (required)
Where your matomo install is:
'sylvainjule.matomo.url' => 'https://analytics.yourdomain.com'
At the end of the url if I forgot the "/" the snippet matomo doesn't work with my installation of matomo. Is this the expected behavior ?
We are currently deploying a site that makes extensive use of custom routes to 'remap' a page's native URL to a more logical and user-memorable one. So, for example, an article on URL...:
https://example.com/home/content/articles/movies-to-watch-with-your-dog
...becomes:
https://example.com/pets/movies-to-watch-with-your-dog
Matomo is already able to catch this, and tracks all visits to custom-routed URLs normally in the Matomo dashboard. Unfortunately, we cannot use the 'page widget' in the Panel, because it looks for the tracked data based on the 'original' (non-routed) URL...
It would be nice if we could let the plugin know that certain pages have custom URLs, so it could retrieve the data from the 'correct' URL instead. Maybe this could be done through a plugin option, or - better still - through a custom blueprint option using the query language. Something like this, in our page's article.yml blueprint:
options:
matomopath: "https://example.com/{{page.category}}/{{page.slug}}"
Hello,
i tried to use your blueprints, but my kirby does not know or shows an error
" Argument 2 passed to Kirby\Cms\Blueprint::normalizeColumns() must be of the type array, string given, called in /www/htdocs/w013ae79/brunnerthomas.com/kirby/src/Cms/Blueprint.php on line 694 "
when i use the type: matomo-main or matomo-sidebar
"
matomo:
label: Matomo Analytics
columns:
- width: 3/4
sections:
main:
type: matomo-main
- width: 1/4
sections:
sidebar:
type: matomo-sidebar "
Do you have any clue why?
Line 50 in ea6fb7e
if(is_callable($this->token)) {
$this->token = $this->token();
}
to solve loading from .env file
https://forum.getkirby.com/t/unable-initialize-env-file/14877
theres a bug in the readme.
under "TLDR โ Just get me started" is a code snippet:
return array(
'sylvainjule.matomo.url' => 'http://your-matomo.url',
'sylvainjule.matomo.id' => 'mywebsite',
'sylvainjule.matomo.token' => 'token_auth,
);
heres a missing ' at 'token_auth, -> 'token_auth',
even with the fix in V 1.0.6 no data get displayed.
In the readme it says to copy <?php echo snippet('matomo') ?>
into the footer. Later it says to put this somewhere <?php snippet('matomo'); ?>
but both echos don't seem to work. The snippet doesn't get inserted.
Good afternoon
I tried the plugins blueprints in the panel with the most current Kirby v4 alpha but it does not work - I get some weird API redirects.
Are there plans to make the plugin work with v4?
Thanks
Andreas
The plugin doesn't work anymore with Kirby 3.6.1:
index.js:1 TypeError: this.load is not a function
at a.created (index.js?1638272587:formatted:17255)
at Vt (vendor.js:6)
at nn (vendor.js:6)
at a.Cn._init (vendor.js:6)
at new a (vendor.js:6)
at vendor.js:6
at init (vendor.js:6)
at vendor.js:6
at f (vendor.js:6)
at v (vendor.js:6)
created() {
this.load().then(d=>{
this.url = d.url,
this.link = d.link,
this.realtime = d.realtime,
this.summary = d.summary
}
First of all, great plugin! Thank you for that.
Now to my request: would it be possible to add the setDoNotTrack setting to the config options? See https://developer.matomo.org/api-reference/tracking-javascript#configuration-of-the-tracker-object
The chart shows only data from "Today" correctly.
Matomo-Version: 3.9.1
Here's a screenshot from the matomo dashboard
The api responses look reasonable to me. (I uploaded the json responses here)
and that's what the plugin in kirby looks like:
Today looks right.
Month is actually correct...since it's the first day of the month today.
Hi,
Would it be possible to move the stats onto separate panel area?
The rational behind having the matomo stats in separate panel area, is to declutter the site page in panel.
I looked into implementing it myself, but got lost midway through. According to Kirby Team, this is apparently an easy task. Would you possibly consider it please.
Thank you
I get an error "TypeError: Cannot read property 'current' of undefined" in the blueprint for individual Matomo page statistics while using Kirby 3.6 alpha:
matomo:
type: matomo-page
overview: true
TypeError: Cannot read property 'current' of undefined
at a.currentLanguage (index.js?1629713017:formatted:12463)
at vn.get (vendor.js:6)
at vn.evaluate (vendor.js:6)
at a.currentLanguage (vendor.js:6)
at a. (vendor.js:6)
at vn.get (vendor.js:6)
at new vn (vendor.js:6)
at a.t.$watch (vendor.js:6)
at _n (vendor.js:6)
at vendor.js:6
This is the mentioned line in the code:
currentLanguage: function() {
var e = this.$store.state.languages.current;
return !!e && e.code
},
I'm trying to use this plug in with with Vue matomo and not getting information in the tab view.
have you tried this combination to check if it works?
currently I'm trying to cache the downloaded matomo.js tracking script, because not caching it causes an performance issue in PageSpeed Insights.
would be cool to have an option to cache the matomo.js script with your plugin.
Detection user on matomoo.php file on line 24 is
if(!option('sylvainjule.matomo.trackUsers') && site()->user()) {
it should not be
if(!option('sylvainjule.matomo.trackUsers') && kirby()->user()) {
Hey there,
thank you very much for this terrific plugin. I love how it fits perfectly into Kirby!
Within the overview
widget I found a incorrectly written word in German translation:
This is caused by the toLowerCase()
function on $t('matomo.visits')
in line
Besuche
must always be capitalized in German.
I'm not sure how to deal with this issue, as the lowercasing seems to be intended within the other languages?
Hello !
I have installed and configured the Matomo plugin but no information is displayed and no error is displayed to understand what it's all about.
I don't know how to solve the problem. :-(
Hi,
I'm trying the plugin and so far it works well. Except, that after some visits, the panel starts to show "no data displayed". When I check the console, it took 2 minutes to try to fetch the API and finally it returns "failed to open stream".
But if I use the Janitor buit-in job "cleanCache" from Janitor plugin. It works? I didn't set anything in the config.php regarding the cache. I know my host (gandi) used varnish, but not sure it is related? Any clues?
On my installation the plugin can't access my Matomo API. I checked the URL it's trying to use an it seems that all special characters get encoded. This is the actual error Firefox is throwing: (I changed the URL and the token).
file_get_contents(https://my-website.de/matomo?module=API&method=API.getBulkRequest&token_auth=MY_TOKEN&format=JSON&urls[0]=method%3DReferrers.getReferrerType%26idSite%3D1%26period%3Dmonth%26date%3Dtoday%26language%3Dde%26filter_limit%3D5&urls[1]=method%3DReferrers.getWebsites%26idSite%3D1%26period%3Dmonth%26date%3Dtoday%26language%3Dde%26filter_limit%3D5&urls[2]=method%3DReferrers.getSocials%26idSite%3D1%26period%3Dmonth%26date%3Dtoday%26language%3Dde%26filter_limit%3D5&urls[3]=method%3DDevicesDetection.getType%26idSite%3D1%26period%3Dmonth%26date%3Dtoday%26language%3Dde%26filter_limit%3D5&urls[4]=method%3DReferrers.getKeywords%26idSite%3D1%26period%3Dmonth%26date%3Dtoday%26language%3Dde%26filter_limit%3D5&urls[5]=method%3DActions.getPageUrls%26idSite%3D1%26period%3Dmonth%26date%3Dtoday%26language%3Dde%26filter_limit%3D5): failed to open stream: HTTP request failed!
If I replace all &
with ampersands again the URL works in the browser. Do you have any idea how I could fix this?
Matomo has a built-in function called 'Content Tracking', which allows you to track how many times specific page elements are displayed in the viewport, and clicked by the user. This is often used, for example, for Ad tracking - counting how many times each ad was shown and clicked.
When developing site with 'content tracking', the content being tracked by client is often going to be managed in Kirby: usually, each 'content' is going to have its own page in Kirby. In the Ad tracking example, for instance, each Ad would have its own page in the Kirby backend - where the user can specify things like the dates the ad should start/stop showing on the site, and the pages where it should be shown.
When we have Kirby pages that are Matomo 'contents', the page widget doesn't work - because these are not 'pages', they are only elements that appear inside other pages. But we still need them tracked!... For this situation, we would need a special 'content' widget instead of a page widget - and a way to specify the content URL/details to be retrieved from Matomo. Like the page widget, the 'content widget' could have some useful summary information - like how many times the content was displayed and interacted with in the last month - which would save the user having to go into the Matomo dashboard to look.
Here is some useful information from the Matomo docs:
Basic User info on what 'content tracking' is:
https://matomo.org/docs/content-tracking/
Developer info on how to set it up in your pages:
https://developer.matomo.org/guides/content-tracking
How to retrieve tracked content data via API:
https://developer.matomo.org/api-reference/reporting-api#Contents
In kirby-matomo/lib/snippets/matomo.php the site id is hard-coded to:
_paq.push(['setSiteId', '1']);
Should this use sylvainjule.matomo.id from config.php?
I installed matamo and did a test with a standalone test.php page containing the tracking code generated by matamo.
Visitors from the test.php page are displayed in matamo.
I also added the configuration to /site/config/config.php:
return array(
'sylvainjule.matomo.url' => 'http://your-matomo.url',
'sylvainjule.matomo.id' => 'mywebsite',
'sylvainjule.matomo.token' => 'token_auth',
);
of course with my values.
Is it correct to add this section at the very end of config.php, i.e. after the last "];"?
I also tried to include the code but I'm not sure where it belongs.
Do you have any idea what is wrong on my side?
When installing your (excellent) plugin via composer, I get this:
The section type "matomo-main" is not valid
.. when trying to include it in my blueprint .. any ideas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.