Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


SOLVED Matomo & WP - no data being collected


  • I've connected Matomo to my WP site using the WP-PIWIK plugin and I can see my site in Matomo dashboard. It's been a few days since the install and there's zero data being shown. This is all default settings in Matomo. Am I supposed to configure something for it to start working properly?

    Also, I'm not sure where I saw this before but are cron jobs disabled for WP (unmanaged) or on DO+Cloudron servers by default?

    Thanks!

  • Staff

    I am not sure how the WP-Piwik plugin works, but matomo usually gives code snippets to be embedded into the website to collect data.

    Maybe you could try that first to ensure Matomo is working as expected?


  • @humptydumpty on the Tracking tab, did you actually enable the tracking script? It isn’t enough for that plug-in to just connect to your analytics server, it has to be enabled on the Tracking tab too.


  • @nebulon

    I checked the source code on the webpage and can confirm the matomo code snippet is present in there.

    @d19dotca

    If you're referring to the ENABLE TRACKING page in WP-Piwik's settings page, then yes, I have default tracking selected. I also tried Use js/index.php

    In my Matomo dashboard (Cloudron app), I can see the site that WP-Piwik created and have it selected to show the whole week but no data there either.


  • @nebulon I misunderstood what you said. I'll try that and report back.


  • @nebulon I deleted the wp-piwik plugin. Cleared the cache and confirmed the code removal. Deleted the site in Matomo and created a new one and pasted the new tracking code manually in WP. Cleared the cache again and confirmed the tracking code is in there. No data is being tracked.


  • I installed the Matomo WP plugin (non-piwik) that installs the entire Matomo stuff inside of of the WP site and that also doesn't work.

    Here is the Matomo WP plugin report from the Diagnostics page.

    What stand out to me is the WP cron being disabled. Is this needed?

    • DISABLE_WP_CRON: Yes
    # Matomo
    
    * Matomo Plugin Version: 1.3.2
    * Config exists and is writable.: Yes ("$ABSPATH/wp-content/uploads/matomo/config/config.ini.php" )
    * JS Tracker exists and is writable.: Yes ("$ABSPATH/wp-content/uploads/matomo/matomo.js" )
    * Plugin directories: Yes ([{"pluginsPathAbsolute":"$ABSPATH\/wp-content\/plugins\/matomo\/plugins","webrootDirRelativeToMatomo":"..\/"}])
    * Tmp directory writable: Yes ($ABSPATH/wp-content/cache/matomo)
    * Matomo Version: 3.14.0
    * Matomo Blog idSite: 1
    * Matomo Install Version: 1.3.2 (Install date: 2020-11-16 12:46:07)
    
    ## Endpoints
    
    * Matomo JavaScript Tracker URL:  ($site_url/wp-content/uploads/matomo/matomo.js)
    * Matomo JavaScript Tracker - WP Rest API:  ($site_url/wp-json/matomo/v1/hit/)
    * Matomo HTTP Tracking API:  ($site_url/wp-content/plugins/matomo/app/matomo.php)
    * Matomo HTTP Tracking API - WP Rest API:  ($site_url/wp-json/matomo/v1/hit/)
    
    ## Crons
    
    * Server time: 2020-11-16 19:08:21
    * Blog time: 2020-11-16 13:08:21 (Below dates are shown in blog timezone)
    * Sync users & sites: Next run: 2020-11-17 12:46:06 (23 hours 37 min) ( Last started: 2020-11-16 12:46:37 (-21 min 44s). Last ended: 2020-11-16 12:46:37 (-21 min 44s). Interval: daily)
    * Archive: Next run: 2020-11-16 13:46:06 (37 min 45s) ( Last started: 2020-11-16 12:46:37 (-21 min 44s). Last ended: 2020-11-16 12:46:38 (-21 min 43s). Interval: hourly)
    * Update GeoIP DB: Next run: 2020-12-16 12:46:06 (29 days 23 hours) ( Last started: 2020-11-16 12:46:38 (-21 min 43s). Last ended: 2020-11-16 12:46:39 (-21 min 42s). Interval: matomo_monthly)
    
    ## Mandatory checks
    
    * PHP version >= : ok 
    * PDO extension: ok 
    * PDO\MYSQL extension: ok 
    * MYSQLI extension: ok 
    * Other required extensions: ok 
    * Required functions: ok 
    * Required PHP configuration (php.ini): ok 
    * Directories with write access: ok 
    * Directories with write access for Tag Manager: ok 
    
    ## Optional checks
    
    * Tracker status: ok 
    * Memory limit: ok 
    * Time zone: ok 
    * Open URL: ok 
    * PageSpeed disabled: ok 
    * GD > 2.x + Freetype (graphics): ok 
    * Other extensions: ok 
    * Other functions: ok 
    * Filesystem: ok 
    * Archive Cron: ok 
    * Last Successful Archiving Completion: ok 
    * Max Packet Size: ok 
    * Geolocation: ok 
    * Update over HTTPS: ok 
    * Writable JavaScript Tracker ("/matomo.js"): ok 
    * Supports Async Archiving: Yes
    * Location provider ID: geoip2php
    * Location provider available: Yes
    * Location provider working: Yes
    * Warning Proxy header: HTTP_X_FORWARDED_FOR (A proxy header is set which means you maybe need to configure a proxy header in the Advanced settings to make location reporting work. If the location in your reports is detected correctly, you can ignore this warning. Learn more: https://matomo.org/faq/wordpress/how-do-i-fix-the-proxy-header-warning-in-the-matomo-for-wordpress-system-report/)
    
    ## Matomo Settings
    
    * Track mode: default
    * Track codeposition: footer
    * Track api endpoint: default
    * Track js endpoint: default
    * Version history: 1.3.2
    * Core version: 3.14.0
    * Last tracking settings update: 1605552776
    * Last settings update: 1605552776
    * Track content: all
    * Track user id: email
    
    ## Logs
    
    * None: 
    
    # WordPress
    
    * Home URL: $site_url
    * Site URL: $site_url
    * WordPress Version: 5.5.3
    * Number of blogs: 1
    * Multisite Enabled: No
    * Network Enabled: No
    * WP_DEBUG: No
    * WP_DEBUG_DISPLAY: No
    * WP_DEBUG_LOG: No
    * DISABLE_WP_CRON: Yes
    * FORCE_SSL_ADMIN: Yes
    * WP_CACHE: Yes
    * CONCATENATE_SCRIPTS: -
    * COMPRESS_SCRIPTS: -
    * COMPRESS_CSS: -
    * ENFORCE_GZIP: -
    * WP_LOCAL_DEV: -
    * DIEONDBERROR: -
    * WPLANG: -
    * ALTERNATE_WP_CRON: -
    * WP_CRON_LOCK_TIMEOUT: 60
    * WP_DISABLE_FATAL_ERROR_HANDLER: -
    * MATOMO_SUPPORT_ASYNC_ARCHIVING: -
    * MATOMO_TRIGGER_BROWSER_ARCHIVING: -
    * MATOMO_ENABLE_TAG_MANAGER: -
    * MATOMO_SUPPRESS_DB_ERRORS: -
    * MATOMO_ENABLE_AUTO_UPGRADE: -
    * MATOMO_DEBUG: -
    * MATOMO_SAFE_MODE: -
    * MATOMO_GLOBAL_UPLOAD_DIR: -
    * MATOMO_LOGIN_REDIRECT: -
    * Permalink Structure: /%postname%/
    * Possibly uses symlink: No
    * Compatible content directory: Yes
    
    # WordPress Plugins
    
    * AuthLDAP: 2.4.2
    * Contact Form 7: 5.3
    * Jetpack by WordPress.com: 9.1
    * Matomo Analytics - Ethical Stats. Powerful Insights.: 1.3.2
    * MC4WP: Mailchimp for WordPress: 4.8.1
    * Redis Object Cache: 2.0.15 (Network enabled)
    * Safe SVG: 1.9.9
    * Slider Revolution: 6.2.23
    * Tawk.to Live Chat: 0.4.3
    * WooCommerce: 4.7.0
    * WooCommerce Shipping & Tax: 1.25.2
    * WooCommerce Stripe Gateway: 4.5.3
    * Woodmart Core: 1.0.27
    * WordPress Importer: 0.7
    * WPBakery Page Builder: 6.4.1
    * WP Mail SMTP: 2.5.1
    * WP Rocket: 3.7.5
    * Yoast SEO: 15.2.1
    * Active Plugins: 18 (authLdap-2.4.2 contact-form-7 jetpack js_composer mailchimp-for-wp matomo redis-cache revslider safe-svg tawkto-live-chat woocommerce-gateway-stripe woocommerce-services woocommerce woodmart-core wordpress-importer wordpress-seo wp-mail-smtp wp-rocket)
    
    # Server
    
    * Server Info: Apache/2.4.29 (Ubuntu)
    * PHP OS: Linux
    * PHP Version: 7.4.12
    * PHP SAPI: apache2handler
    * PHP Found Binary: php -q
    * Timezone: UTC
    * WP timezone: America/Chicago
    * Locale: en_US
    * User Locale: en_US
    * Memory Limit: 256M (At least 128MB recommended. Depending on your traffic 256MB or more may be needed.)
    * WP Memory Limit: 40M
    * WP Max Memory Limit: 256M
    * Timezone version: 0.system
    * Time: 1605553701
    * Max Execution Time: 30
    * Max Post Size: 64M
    * Max Upload Size: 67108864
    * Max Input Vars: 1000
    * Disabled PHP functions: Yes (pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,)
    * zlib.output_compression is off: Yes
    * Curl Version: 7.58.0, OpenSSL/1.1.1g
    * Suhosin installed: No
    
    # Database
    
    * MySQL Version: 5.7.31
    * Mysqli Connect: Yes
    * Force MySQL over Mysqli: No
    * DB Prefix: wp_
    * DB CHARSET: utf8
    * DB COLLATE: 
    * SHOW ERRORS: No
    * SUPPRESS ERRORS: No
    * Uses Socket: No
    * Uses IPv6: No
    * Matomo tables found: 43
    * Matomo users found: 1
    * Matomo sites found: 1
    * Required permissions: OK
    
    # Browser
    
    * Browser:  (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:82.0) Gecko/20100101 Firefox/82.0)
    * Language: en-us,en
    
    	
    

  • @humptydumpty CRON isn't needed. Have you tried resetting the Pwiki plugin settings under the Tools section?

    926c390a-af91-4a51-8195-2c8c916ee009-image.png


  • @marcusquinn I'll reinstall and test again.


  • @humptydumpty That definitely should work then, that's very strange.

    Just to confirm... if you go to the front-end of the site in a private/incognito window, you can verify that the tracking code exists in the source? If it does, then this seems more like a server-side issue than the WordPress plugin side of things. Though I'm not certain what could block that from being tracked in Matomo side either, unless you have your IP address in the list of IPs to ignore?


  • @d19dotca Yes, I'm checking to see if the code is there after clearing the cache and I have a firefox private window and an incognito chrome page open. I'm checking for the code's removal and then the new addition and there's no change. So far, I've installed Matomo in every possible way with no luck getting it to work. I even tested it on another WP site that I have (on the same Cloudron server though) with no luck either. I feel like giving up at this point.

    Edit: Nothing in the IP list. I made sure not to exclude any IP's or the admin role from being monitored. I've reset the piwik plugin like @marcusquinn suggested and that didn't help either. I've tried using fOpen instead of cURL and started ticking/testing other options to see if it'll fix it. No dice.

    I just remembered that I still have one WP site that I haven't migrated to the new server yet that's hosted on a different server using ServerPilot. I'm going to give that a shot and see if it works. If it fails, I'm gonna call it a day and go get drunk.

  • Staff

    @humptydumpty Let me try to setup a fresh matomo+wp instance and try to check might be going wrong.


  • @girish Sounds good but it's working now. It seems my IP is being ignored even though no setting is active that would exclude it. I've checked the Matomo dashboard and the WP-Piwik settings. After using other devices and connecting each to a different VPN server so the IP's aren't the same, the hits started showing up for all sites in Matomo dashbboard and a few minutes later, in the WP dashboard too.

  • Staff

    @humptydumpty Oh maybe that is the bug? That the geolite db is out of date or something? I just pushed a new matomo package with updates to the geolite db.


  • @girish I applied the update you just released and that didn't seem to fix it. I'm glad the other hits are registering though.

  • Staff

    @humptydumpty Guess what I faced exactly the same behavior as you did (I didn't test with WP though). Simply, matomo was just not collecting data. I even tested from my mobile network and that didn't work either.

    After some debugging, I found that the "common" thing is that I am using firefox (on linux desktop and android). I tried with chrome and lo it starts working! That led me down to investigate some privacy setting. I found that Firefox sends the DNT (do not track) header by default and matomo respects this header (by default). If you tell matomo to ignore the DNT header, it works. You can do this in Privacy -> Users opt-out and then it starts registering firefox. Obviously, it's probably a good idea to keep this turned on but atleast I found this is the reason it wasn't working.

    5576366c-9c1c-425b-b7af-5f658a49f484-image.png

  • Staff

    To conclude this:

    • Add the following to config/config.ini.php and restart matomo:
    [Tracker]
    debug = 1
    
    • Then, add following line to your site:
    <img src="https://matomo.example.com/piwik.php?idsite=1&rec=1" style="border:0;" alt="" />
    
    • Then, check the response for piwik.php in devtool network view.
    [2020-11-16 23:53:31] piwik.DEBUG: Debug enabled - Input parameters: array (   'idsite' => '1',   'rec' => '1', ) {"params":"array (\n  'idsite' => '1',\n  'rec' => '1',\n)"} {"class":"Piwik\\Tracker","request_id":"9757e"}
    
    [2020-11-16 23:53:31] piwik.DEBUG: Current datetime: 2020-11-16 23:53:31 {"date":"2020-11-16 23:53:31"} {"class":"Piwik\\Tracker","request_id":"9757e"}
    
    [2020-11-16 23:53:31] piwik.DEBUG: Executing Piwik\Plugins\CoreHome\Tracker\VisitRequestProcessor::manipulateRequest()... [] {"class":"Piwik\\Common","request_id":"9757e"}
    
    [2020-11-16 23:53:31] piwik.DEBUG: Executing Piwik\Plugins\IntranetMeasurable\Tracker\RequestProcessor::manipulateRequest()... [] {"class":"Piwik\\Common","request_id":"9757e"}
    
    [2020-11-16 23:53:31] piwik.DEBUG: Executing Piwik\Plugins\Actions\Tracker\ActionsRequestProcessor::manipulateRequest()... [] {"class":"Piwik\\Common","request_id":"9757e"}
    
    [2020-11-16 23:53:31] piwik.DEBUG: Executing Piwik\Plugins\Goals\Tracker\GoalsRequestProcessor::manipulateRequest()... [] {"class":"Piwik\\Common","request_id":"9757e"}
    
    [2020-11-16 23:53:31] piwik.DEBUG: Executing Piwik\Plugins\Ecommerce\Tracker\EcommerceRequestProcessor::manipulateRequest()... [] {"class":"Piwik\\Common","request_id":"9757e"}
    
    [2020-11-16 23:53:31] piwik.DEBUG: Executing Piwik\Plugins\SitesManager\Tracker\SitesManagerRequestProcessor::manipulateRequest()... [] {"class":"Piwik\\Common","request_id":"9757e"}
    
    [2020-11-16 23:53:31] piwik.DEBUG: Executing Piwik\Plugins\CustomVariables\Tracker\CustomVariablesRequestProcessor::manipulateRequest()... [] {"class":"Piwik\\Common","request_id":"9757e"}
    
    [2020-11-16 23:53:31] piwik.DEBUG: Executing Piwik\Plugins\PrivacyManager\Tracker\RequestProcessor::manipulateRequest()... [] {"class":"Piwik\\Common","request_id":"9757e"}
    
    [2020-11-16 23:53:31] piwik.DEBUG: Executing Piwik\Plugins\Heartbeat\Tracker\PingRequestProcessor::manipulateRequest()... [] {"class":"Piwik\\Common","request_id":"9757e"}
    
    [2020-11-16 23:53:31] piwik.DEBUG: Executing Piwik\Plugins\CoreHome\Tracker\VisitRequestProcessor::processRequestParams()... [] {"class":"Piwik\\Common","request_id":"9757e"}
    
    [2020-11-16 23:53:31] piwik.DEBUG: DoNotTrack header found! [] {"class":"PrivacyManager","request_id":"9757e"}
    
    [2020-11-16 23:53:31] piwik.DEBUG: Visitor excluded. [] {"class":"CoreHome","request_id":"9757e"}
    
    [2020-11-16 23:53:31] piwik.DEBUG: -> aborting due to processRequestParams method [] {"class":"Piwik\\Common","request_id":"9757e"}
    
    [2020-11-16 23:53:31] piwik.DEBUG: -> Scheduled tasks not running in Tracker: Browser archiving is disabled. [] {"class":"Piwik\\Common","request_id":"9757e"}
    
    [2020-11-16 23:53:31] piwik.DEBUG: Nothing to notice => default behaviour [] {"class":"Piwik\\Common","request_id":"9757e"}
    
    [2020-11-16 23:53:31] piwik.DEBUG: End of the page. [] {"class":"Piwik\\Common","request_id":"9757e"}
    
    [2020-11-16 23:53:31] piwik.DEBUG: array (   'MATOMO_SESSID' => '31047d5jt9einvp951h79t0pnm', ) [] {"class":"Piwik\\Common","request_id":"9757e"}
    
    [2020-11-16 23:53:31] piwik.DEBUG:  [] {"class":"Piwik\\Common","request_id":"9757e"}
    
    

    It says clearly it gets ignored because of do not track header.


  • AH good catch, the DNT may have been the cause there then. Always forget about that thing. lol.


  • @girish That did it! Partially at least. I have more "privacy" plugins. It's working now if I open a private window since it doesn't load the other plugins. It's great to know it's not a server/app issue at least. Here's the full list of firefox plugins I'm running. One (or more) of them is still causing issues for Matomo.

    • Decentraleyes
    • Facebook Container
    • Firefox Multi-Account Containers
    • Privacy Badger
    • Privacy Pass
    • True Sight
    • uBlock Origin

  • @humptydumpty Nice, happy to recommend adding LocalCDN.org to that if you're interested.