GithubHelp home page GithubHelp logo

sylvainjule / kirby-matomo Goto Github PK

View Code? Open in Web Editor NEW
133.0 7.0 8.0 909 KB

Matomo integration for Kirby, in both your panel and templates. Kirby 3 only.

License: MIT License

PHP 39.83% JavaScript 0.90% Vue 43.58% SCSS 15.69%
kirby matomo piwik analytics metrics dashboard

kirby-matomo's Introduction

Kirby Matomo

This plugin helps you generate a tracking code for Matomo, and displays some useful metrics directly within the panel.

screenshot-dashboard-faded


Overview

This plugin is completely free and published under the MIT license. However, if you are using it in a commercial project and want to help me keep up with maintenance, please consider making a donation of your choice.

TLDR – Just get me started πŸ‘€

  1. Install Matomo on your server.
  2. Download and copy this repository to /site/plugins/matomo
  3. Set the following values in site/config/config.php :
return array(
    'sylvainjule.matomo.url'        => 'http://your-matomo.url',
    'sylvainjule.matomo.id'         => 'mywebsite',
    'sylvainjule.matomo.token'      => 'token_auth',
);
  1. Add this code to your footer snippet: <?php echo snippet('matomo') ?>
  2. Visit the Matomo panel area or copy this blueprint under a dedicated tab / page in the panel.

You're all set.


1. Why Matomo?

  • It's open-source (who doesn't like open-source?)
  • It's free (like, really free. You don't pay with your data)
  • It's self-hosted (which means more control for you over your data)
  • It respects your visitors privacy (IP Anonymization, automated logs deletion, data ownership)
  • It now integrates smoothly with Kirby 4 ✌️

2. Installation

Kirby 3: up to 1.0.7 Kirby 4: 2.0.0+

Download and copy this repository to /site/plugins/matomo

Alternatively, you can install it with composer: composer require sylvainjule/matomo


3. Options

Here is an overview of the available options with their default values:

return array(
    'sylvainjule.matomo.url'            => false, #required
    'sylvainjule.matomo.id'             => false, #required
    'sylvainjule.matomo.token'          => false, #required for the panel integration
    'sylvainjule.matomo.active'         => true,
    'sylvainjule.matomo.debug'          => false,
    'sylvainjule.matomo.trackUsers'     => false,
    'sylvainjule.matomo.disableCookies' => false,
    'sylvainjule.matomo.blacklist'      => ['127.0.0.1', '::1'],
    'sylvainjule.matomo.basicAuth'      => null,
    'sylvainjule.matomo.area'           => true
    'sylvainjule.matomo.area.label'     => 'Matomo',
    'sylvainjule.matomo.area.headline'  => null,

);

3.1. url (required)

Where your matomo install is:

'sylvainjule.matomo.url' => 'https://analytics.yourdomain.com'

3.2. id (required)

A single Matomo install can host multiple websites. The plugin needs to know the id of the one to look for:

'sylvainjule.matomo.id' => 'mywebsite'

3.3. token (required for the panel integration)

The panel sections will need to make calls to your Matomo API. A token_auth is required, you will find it in Settings > API in the control panel. Copy-paste the string without the &token_auth= prefix.

Below is an example token. Please note that this token is private and shouldn't be made public. Once added, if you need to publish your code please create something like a duplicated config.github.php which will contain the non-sensitive informations, and add your real config.php to your .gitignore.

'sylvainjule.matomo.token' => 'gQ7TQgg8EFe3h29F9t4aJqC33VQdPfFP4M'

3.4. active

You can deactivate the snippet by setting this value to false.

'sylvainjule.matomo.active' => true

3.5. blacklist

Localhost is in the blacklist as default. You can change it.

'sylvainjule.matomo.blacklist' => ['127.0.0.1', '::1']

3.6. trackUsers

The script is only active for not logged in users by default. If you want to change it, set this option to true.

'sylvainjule.matomo.trackUsers' => false

3.7. debug

If you want to always run the script (even on localhost or if you are logged in), set this option to true.

'sylvainjule.matomo.debug' => false

3.8. disableCookies

If you want to use Matomo without any tracking cookies on the user side, set this option to true. You can read more about this setting in the Matomo FAQ.

'sylvainjule.matomo.disableCookies' => false

3.9. basicAuth

If your Matomo instance is additionally secured by Basic Authentication, you can configure these credentials in the format USERNAME:PASSWORD.

'sylvainjule.matomo.basicAuth' => null

3.11. area

If you want to hide the Matomo Panel area, set this option to false.

'sylvainjule.matomo.area' => true

3.11. area.label

If you want to change the label for the Matomo Panel area (displayed in the menu and the breacrumb), you can configure it:

'sylvainjule.matomo.area.label' => 'Matomo'

3.12. label

If you also want to change the headline for the Matomo Panel area, you can set it with the area.headline option. If not specified, the label will be used as fallback.

'sylvainjule.matomo.area.headline' => 'Custom area headline'

4. Template usage

You only need to include the snippet in your code somewhere:

<?php snippet('matomo'); ?>

5. Panel display: Area

The panel area displays metrics for the whole website. It is available at the { site.url }/panel/matomo route. Alternatively, you can configure it in a custom tab / blueprint (see below). In such a case, you might want to disable the area completely:

'sylvainjule.matomo.area' => false

You can also customize its title with the area.label option:

'sylvainjule.matomo.area.label' => 'Analytics'

6. Panel display: Sections

The panel dashboard can be configured in a custom tab / blueprint with sections.

6.1. Basic blueprint example

Please make sure that you have included your token_auth in your config.

Place this snippet in a dedicated tab / blueprint:

columns:
  - width: 3/4
    sections:
      main:
        type: matomo-main
  - width: 1/4
    sections:
      sidebar:
        type: matomo-sidebar

6.2. Options

Hiding components

There are a bunch of options to help you adjust this default panel view. Both sections have three components :

  • The mainview (matomo-main) includes chart, overview and widgets
  • The sidebar (matomo-sidebar) includes link, realtime and summary

You can chose to hide them like this:

columns:
  - width: 3/4
    sections:
      main:
        type: matomo-main
        chart: false
        overview: false
        widgets: false
  - width: 1/4
    sections:
      sidebar:
        type: matomo-sidebar
        link: false
        realtime: false
        summary: false

(Ok, there would be nothing left to work with here, but you get the idea).

Hiding and sorting widgets

Widgets can be sorted to your taste. You can also choose to display only some of them. Here's a glimpse of the option with all widgets explicitely set, change the order of its list or remove entries to filter widgets.

columns:
  - width: 3/4
    sections:
      main:
        type: matomo-main
        widgets:
          - referrerType
          - websites
          - socials
          - devicesType
          - keywords
          - popularPages
Hiding period ranges

By default, all 4 ranges are displayed (This year, This month, Last 7 days, Today). You can choose to hide some of them by explicitely excluding them from the periods list:

columns:
  - width: 3/4
    sections:
      main:
        type: matomo-main
        periods:
          - year
          - month
          - week
          - day
Changing defaults

You have acces to two default options, the period and the widgets limit.

  • period is the default active period on first load of the section. It is a string to chose from one of the periods above. Default is month.
  • limit is the number of entries displayed within the widgets. Default is 5.
columns:
  - width: 3/4
    sections:
      main:
        type: matomo-main
        defaults:
          period: month
          limit: 5

6.3. Complete blueprint example

Here's a glimpse of how the blueprint might look with all options explicitely set:

columns:
  - width: 3/4
    sections:
      main:
        type: matomo-main
        chart: true
        overview: true
        defaults:
          period: month
          limit: 5
        periods:
          - year
          - month
          - week
          - day
        widgets:
          - referrerType
          - websites
          - socials
          - devicesType
          - keywords
          - popularPages
  - width: 1/4
    sections:
      sidebar:
        type: matomo-sidebar
        link: true
        realtime: true
        summary: true

7. Panel page widget

The panel page widget displays metrics for a given page, both in single-language or multi-language websites.

Any feedback regarding this widget's behaviour is welcome. It might still need to be refined, inputs from a larger variety of live websites would be a great help. Check the potential pitfalls below.

screenshot-page

7.1. Basic blueprint example

Please make sure that you have included your token_auth in your config.

Place this snippet in your page blueprint:

columns:
  - width: 1/3
    sections:
      matomo:
        type: matomo-page

The section will automatically detect the page uri, and fetch its metrics for the given period.

7.2. Options

Period

You can choose the period displayed, which can either be year, month, week or day. Default is month.

matomo:
  type: matomo-page
  period: month
Multi-language overview

The plugin will automatically detect if multi-language is switched on, and fetch the metrics of the current language.

Optionally, you can also display the metrics of all languages combined with the overview option. Default is false.

matomo:
  type: matomo-page
  overview: false

7.3. Potential pitfalls

  • 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.
  • The metrics shown might not be accurate / complete if you have changed the default language after Matomo started its data collection.

8. License

MIT


9. Credits

Kirby 2 had some Piwik integration plugins:

The snippet integration has been shamelessly adapted from @jenstornell's kirby-ga. πŸ‘

kirby-matomo's People

Contributors

johannschopplich avatar mrflix avatar philipptrenz avatar plantalabs avatar preya avatar soerenengels avatar sylvainjule avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

kirby-matomo's Issues

readme missing '

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',

Use Custom Routes for Pages

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}}"

How can I see tracking data of my blog posts?

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?

Ampersands in API URL get encoded

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&amp;method=API.getBulkRequest&amp;token_auth=MY_TOKEN&amp;format=JSON&amp;urls[0]=method%3DReferrers.getReferrerType%26idSite%3D1%26period%3Dmonth%26date%3Dtoday%26language%3Dde%26filter_limit%3D5&amp;urls[1]=method%3DReferrers.getWebsites%26idSite%3D1%26period%3Dmonth%26date%3Dtoday%26language%3Dde%26filter_limit%3D5&amp;urls[2]=method%3DReferrers.getSocials%26idSite%3D1%26period%3Dmonth%26date%3Dtoday%26language%3Dde%26filter_limit%3D5&amp;urls[3]=method%3DDevicesDetection.getType%26idSite%3D1%26period%3Dmonth%26date%3Dtoday%26language%3Dde%26filter_limit%3D5&amp;urls[4]=method%3DReferrers.getKeywords%26idSite%3D1%26period%3Dmonth%26date%3Dtoday%26language%3Dde%26filter_limit%3D5&amp;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 &amp; with ampersands again the URL works in the browser. Do you have any idea how I could fix this?

Please add an option to cache matomo.js script

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.

Panel Error: The JSON response could not be parsed / Forbidden / You don't have permission to access this resource.

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.

Cache folder seems to be empty when this plugin is active

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?

user detection

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()) {

Incorrectly written word in German translation

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:

Bildschirmfoto 2021-10-25 um 12 06 17

This is caused by the toLowerCase() function on $t('matomo.visits') in line

<div class="details">{{ $t('matomo.visits').toLowerCase() }} {{ $t('matomo.period.'+currentPeriod) }}.</div>

as 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?

/ at the end of the url

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 ?

[feature request] Stats in separate panel area

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

Panel blueprint issue

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?

No data display but works after "cleanCache" from Janitor

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?

A 'Content' Widget for Pages Tracked as 'Contents'

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:

Panel page widget not working for pages with custom URLs?

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.

Please Add a 'Buy Me a Coffee/Beer' Button 😁

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! πŸ˜‰

Page widget does not seem to show any existing tracking data

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:

image

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

Main Chart does not show correct data

The chart shows only data from "Today" correctly.
Matomo-Version: 3.9.1

Here's a screenshot from the matomo dashboard
matomo

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

7 days is wrong
7days

Month is actually correct...since it's the first day of the month today.
month

the chart is ok, but the labels are undefined
year

summary

Snippet does not load

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 ❓

Blueprint not working

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
        },

Composer problem

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?

too many request

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 :
Capture d’écran 2021-02-25 aΜ€ 14 10 50

This type of error showing up for 4 other calls :
error: "file_get_contents(https://mydomain.fr/?module=API&amp;methth=mytoken&amp;format=JSON&amp;urls[0]=method%3DVisitsSummary.getVisits%26idSite%3D3%26period%3Dday%26date%3Dtoday&amp;urls[1]=method%3DVisitsSummary.getVisits%26idSite%3D3%26period%3Dday%26date%3Dlast7&amp;urls[2]=method%3DVisitsSummary.getVisits%26idSite%3D3%26period%3Dmonth%26date%3Dtoday&amp;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

Console 400 errors in the panel

I'm getting various 400 (Bad Request) console errors when viewing the Matomo page in the panel:

Screen Shot 2019-09-16 at 15 16 36

When looking directly at these pages, they look like this:

Screen Shot 2019-09-16 at 15 16 09

Is this a specific Kirby API authentification issue?

Compatibility with Kirby v4

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

no visitors are displayed in matamo

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?

this.load is not a function

In Kirby 3.10.0.1 I have the same issue as #37 with the error "this.load is not a function". Plugin Version 2.0.1. In the JS console the error appears twice corresponding to the components/sidebar.vue and components/main.vue files.

index.js:1 TypeError: this.load is not a function
    at a.created (index.js?1714844182:67:106755)
    at dn (vue.js:11:21987)
    at Be (vue.js:11:18221)
    at e._init (vue.js:11:43012)
    at new a (vue.js:11:40283)
    at vue.js:11:33227
    at init (vue.js:11:33258)
    at vue.js:11:67703
    at d (vue.js:11:67980)
    at m (vue.js:11:68556)

Screenshot 2024-05-14 083710

I don't know what is causing it, maybe a kirby issue, not a plugin issue? This is the default panel area of the matomo plugin, I haven't added any blueprints and have added only the basic configuration parameters 'sylvainjule.matomo.url', 'sylvainjule.matomo.id' and 'sylvainjule.matomo.token'. I have deleted the media/panel folder, but the error persists.

Screenshot 2024-05-14 084034

More Graceful Display When Insufficient Data Available

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

screen shot 2019-02-08 at 10 11 01 am

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. πŸ™

Change from 'piwik' to 'matomo' may be needed in snippet

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

  1. the slash at the end of the Matomo URL - which the snippet didn't add (either a check should be added in the snippet, or the docs should explicitly mention it)
  2. the fact that the snippet refers to 'piwik.php' and 'piwik.js', when the new versions of Matomo now use 'matomo.php' and 'matomo.js'.

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.

No data displayed!

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.

  1. I've been using Matomo for a while so the data exists
  2. the URL + siteId + token information are correctly filled in
  3. When I click on the Matomo link of the plugin I arrive correctly at my destination!
  4. the Debug option is set to true in the configuration
  • Matomo v4.0.0
  • working on localhost

I don't know how to solve the problem. :-(

Capture d’écran 2020-11-25 aΜ€ 19 14 53

still no data

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.

Incompatible with Kirby 3.6.1

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
                }

https://github.com/sylvainjule/kirby-matomo/blob/d3f546ef60166022349ae1d8ef2da8ad165fff1a/src/components/sidebar.vue

image

matomo.php tracking snippet / site id

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.