• Hi,

    We have a self hosted up to date Matomo service.

    We have a more than 100 sites on wprdpress with Matomo plugin

    Everything was ok, till a lot of recently massive problem (tracker gone, ID gone).

    Now, all sites have the same ID on the wordpress plugin (2) not in the site manager on my self hosted matomo

    Default tracker does not work with the wordpress plugin.

    Here the the code We use

    <!-- Matomo -->
    <script type="text/javascript">
      var _paq = window._paq = window._paq || [];
      /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
      _paq.push(['setVisitorCookieTimeout', '33696000']);
    _paq.push(['setSessionCookieTimeout', '1800']);
    _paq.push(['setReferralCookieTimeout', '15778463']);
    _paq.push(['trackPageView']);
      _paq.push(['enableLinkTracking']);
      (function() {
        var u="https://url.domain.extension/";
        _paq.push(['setTrackerUrl', u+'matomo.php']);
        _paq.push(['setSiteId', '{MATOMO_IDSITE}']);
        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
        g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
      })();
    </script>
    <!-- End Matomo Code -->

    Here are the tests

    `WP-Matomo 1.0.30
    Mode: http
    
    Test 1/3: global.getPiwikVersion
    
    array(1) {
      ["value"]=>
      string(6) "4.15.1"
    }
    
    array(2) {
      [0]=>
      string(207) "HTTP/1.1 200 OK
    Date: Tue, 24 Oct 2023 14:41:41 GMT
    Server: Apache
    X-Matomo-Request-Id: 430c8
    Cache-Control: must-revalidate
    Transfer-Encoding: chunked
    Content-Type: application/json; charset=utf-8
    
    "
      [1]=>
      string(135) "https://surl.ok/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DAPI.getPiwikVersion%26idSite%3D2&token_auth=..."
    }
    </code></pre>
    
    
    
    <pre class="wp-block-code"><code>Test 2/3: SitesManager.getSitesWithAtLeastViewAccess
    
    array(100) {
      [0]=>
      array(21) {
        ["idsite"]=>
        int(2)
        ["name"]=>
        string(14) "url00"
        ["main_url"]=>
        string(20) "https://url00.ok"
        ["ts_created"]=>
        string(19) "2020-06-19 09:04:02"
        ["ecommerce"]=>
        int(0)
        ["sitesearch"]=>
        int(1)
        ["sitesearch_keyword_parameters"]=>
        string(0) ""
        ["sitesearch_category_parameters"]=>
        string(0) ""
        ["timezone"]=>
        string(12) "Europe/Paris"
        ["currency"]=>
        string(3) "EUR"
        ["exclude_unknown_urls"]=>
        int(0)
        ["excluded_ips"]=>
        string(0) ""
        ["excluded_parameters"]=>
        string(0) ""
        ["excluded_user_agents"]=>
        string(0) ""
        ["excluded_referrers"]=>
        string(0) ""
        ["group"]=>
        string(0) ""
        ["type"]=>
        string(7) "website"
        ["keep_url_fragment"]=>
        int(0)
        ["creator_login"]=>
        string(10) "adminstats"
        ["timezone_name"]=>
        string(6) "France"
        ["currency_name"]=>
        string(4) "Euro"
      }
      [1]=>
      array(21) {
        ["idsite"]=>
        int(3)
        ["name"]=>
        string(5) "url60"
        ["main_url"]=>
        string(20) "https://url60.ok"
        ["ts_created"]=>
        string(19) "2020-06-18 00:00:00"
        ["ecommerce"]=>
        int(0)
        ["sitesearch"]=>
        int(1)
        ["sitesearch_keyword_parameters"]=>
        string(0) ""
        ["sitesearch_category_parameters"]=>
        string(0) ""
        ["timezone"]=>
        string(12) "Europe/Paris"
        ["currency"]=>
        string(3) "EUR"
        ["exclude_unknown_urls"]=>
        int(0)
        ["excluded_ips"]=>
        string(0) ""
        ["excluded_parameters"]=>
        string(0) ""
        ["excluded_user_agents"]=>
        string(0) ""
        ["excluded_referrers"]=>
        string(0) ""
        ["group"]=>
        string(0) ""
        ["type"]=>
        string(7) "website"
        ["keep_url_fragment"]=>
        int(0)
        ["creator_login"]=>
        string(10) "adminstats"
        ["timezone_name"]=>
        string(6) "France"
        ["currency_name"]=>
        string(4) "Euro"
      }
    .....
      [99]=>
      array(21) {
        ["idsite"]=>
        int(101)
        ["name"]=>
        string(7) "urltest"
        ["main_url"]=>
        string(22) "https://urltest.ok"
        ["ts_created"]=>
        string(19) "2020-11-30 00:00:00"
        ["ecommerce"]=>
        int(0)
        ["sitesearch"]=>
        int(1)
        ["sitesearch_keyword_parameters"]=>
        string(0) ""
        ["sitesearch_category_parameters"]=>
        string(0) ""
        ["timezone"]=>
        string(12) "Europe/Paris"
        ["currency"]=>
        string(3) "EUR"
        ["exclude_unknown_urls"]=>
        int(0)
        ["excluded_ips"]=>
        string(0) ""
        ["excluded_parameters"]=>
        string(0) ""
        ["excluded_user_agents"]=>
        string(0) ""
        ["excluded_referrers"]=>
        string(0) ""
        ["group"]=>
        string(0) ""
        ["type"]=>
        string(7) "website"
        ["keep_url_fragment"]=>
        int(0)
        ["creator_login"]=>
        string(10) "adminstats"
        ["timezone_name"]=>
        string(6) "France"
        ["currency_name"]=>
        string(4) "Euro"
      }
    }
    array(2) {
      [0]=>
      string(207) "HTTP/1.1 200 OK
    Date: Tue, 24 Oct 2023 14:41:42 GMT
    Server: Apache
    X-Matomo-Request-Id: c61b6
    Cache-Control: must-revalidate
    Transfer-Encoding: chunked
    Content-Type: application/json; charset=utf-8
    
    "
      [1]=>
      string(158) "https://url.ok/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DSitesManager.getSitesWithAtLeastViewAccess%26idSite%3D2&token_auth=..."
    }
    
    </code></pre>
    
    
    
    <pre class="wp-block-code"><code>est 3/3: SitesManager.getSitesIdFromSiteUrl
    
    array(1) {
      [0]=>
      array(1) {
        ["idsite"]=>
        int(2)
      }
    }
    
    array(2) {
      [0]=>
      string(207) "HTTP/1.1 200 OK
    Date: Tue, 24 Oct 2023 14:41:42 GMT
    Server: Apache
    X-Matomo-Request-Id: 4d794
    Cache-Control: must-revalidate
    Transfer-Encoding: chunked
    Content-Type: application/json; charset=utf-8
    
    "
      [1]=>
      string(185) "https://url.ok/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DSitesManager.getSitesIdFromSiteUrl%26idSite%3D2%26url%3Dhttps%3A%2F%2Furl00.ok&token_auth=..."
    }
    
    
    
    array(2) {
      ["global_settings"]=>
      array(69) {
        ["revision"]=>
        string(10) "2023092201"
        ["last_settings_update"]=>
        string(10) "1698064982"
        ["piwik_mode"]=>
        string(4) "http"
        ["piwik_url"]=>
        string(21) "https://url.ok/"
        ["piwik_path"]=>
        string(0) ""
        ["piwik_user"]=>
        string(0) ""
        ["matomo_user"]=>
        string(0) ""
        ["piwik_token"]=>
        string(3) "set"
        ["auto_site_config"]=>
        string(1) "1"
        ["default_date"]=>
        string(13) "current_month"
        ["stats_seo"]=>
        string(1) "0"
        ["stats_ecommerce"]=>
        string(1) "0"
        ["dashboard_widget"]=>
        string(6) "last90"
        ["dashboard_ecommerce"]=>
        string(1) "0"
        ["dashboard_chart"]=>
        string(1) "0"
        ["dashboard_seo"]=>
        string(1) "0"
        ["toolbar"]=>
        string(1) "0"
        ["capability_read_stats"]=>
        array(5) {
          ["administrator"]=>
          string(1) "1"
          ["author"]=>
          string(1) "0"
          ["contributor"]=>
          string(1) "0"
          ["editor"]=>
          string(1) "0"
          ["subscriber"]=>
          string(1) "0"
        }
        ["perpost_stats"]=>
        string(6) "last90"
        ["plugin_display_name"]=>
        string(14) "Connect Matomo"
        ["piwik_shortcut"]=>
        string(1) "0"
        ["shortcodes"]=>
        string(1) "0"
        ["track_mode"]=>
        string(8) "manually"
        ["track_codeposition"]=>
        string(6) "footer"
        ["track_noscript"]=>
        string(1) "0"
        ["track_nojavascript"]=>
        string(1) "0"
        ["proxy_url"]=>
        string(21) "https://url.ok"
        ["track_content"]=>
        string(8) "disabled"
        ["track_search"]=>
        string(1) "0"
        ["track_404"]=>
        string(1) "0"
        ["add_post_annotations"]=>
        array(0) {
        }
        ["add_customvars_box"]=>
        string(1) "0"
        ["add_download_extensions"]=>
        string(0) ""
        ["set_download_extensions"]=>
        string(0) ""
        ["set_link_classes"]=>
        string(0) ""
        ["set_download_classes"]=>
        string(0) ""
        ["require_consent"]=>
        string(8) "disabled"
        ["disable_cookies"]=>
        string(1) "0"
        ["limit_cookies"]=>
        string(1) "0"
        ["limit_cookies_visitor"]=>
        string(8) "34186669"
        ["limit_cookies_session"]=>
        string(4) "1800"
        ["limit_cookies_referral"]=>
        string(8) "15778463"
        ["track_admin"]=>
        string(1) "0"
        ["capability_stealth"]=>
        array(2) {
          ["administrator"]=>
          string(1) "1"
          ["editor"]=>
          string(1) "1"
        }
        ["track_across"]=>
        string(1) "0"
        ["track_across_alias"]=>
        string(1) "0"
        ["track_crossdomain_linking"]=>
        string(1) "0"
        ["track_feed"]=>
        string(1) "0"
        ["track_feed_addcampaign"]=>
        string(1) "0"
        ["track_feed_campaign"]=>
        string(4) "feed"
        ["track_heartbeat"]=>
        string(1) "0"
        ["track_user_id"]=>
        string(8) "disabled"
        ["cache"]=>
        string(1) "1"
        ["http_connection"]=>
        string(4) "curl"
        ["http_method"]=>
        string(4) "post"
        ["disable_timelimit"]=>
        string(1) "0"
        ["filter_limit"]=>
        string(0) ""
        ["connection_timeout"]=>
        string(1) "5"
        ["disable_ssl_verify"]=>
        string(1) "0"
        ["disable_ssl_verify_host"]=>
        string(1) "0"
        ["piwik_useragent"]=>
        string(3) "php"
        ["piwik_useragent_string"]=>
        string(8) "WP-Piwik"
        ["dnsprefetch"]=>
        string(1) "0"
        ["track_datacfasync"]=>
        string(1) "0"
        ["track_cdnurl"]=>
        string(0) ""
        ["track_cdnurlssl"]=>
        string(0) ""
        ["force_protocol"]=>
        string(8) "disabled"
        ["remove_type_attribute"]=>
        string(1) "0"
        ["update_notice"]=>
        string(7) "enabled"
      }
      ["settings"]=>
      array(6) {
        ["name"]=>
        string(0) ""
        ["site_id"]=>
        string(1) "2"
        ["noscript_code"]=>
        string(149) "                    <noscript><p><img src="https://url.ok/matomo.php?idsite=2&rec=1" style="border:0;" alt="" /></p></noscript>                "
        ["tracking_code"]=>
        string(796) "<!-- Matomo -->
    <script type="text/javascript">
      var _paq = window._paq = window._paq || [];
      /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
      _paq.push(['setVisitorCookieTimeout', '33696000']);
    _paq.push(['setSessionCookieTimeout', '1800']);
    _paq.push(['setReferralCookieTimeout', '15778463']);
    _paq.push(['trackPageView']);
      _paq.push(['enableLinkTracking']);
      (function() {
        var u="https://url.ok/";
        _paq.push(['setTrackerUrl', u+'matomo.php']);
        _paq.push(['setSiteId', '{MATOMO_IDSITE}']);
        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
        g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
      })();
    </script>
    <!-- End Matomo Code -->
    "
        ["last_tracking_code_update"]=>
        string(1) "0"
        ["dashboard_revision"]=>
        string(1) "0"
      }
    }
    `
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘All Site ID revert to same on Self Hosted WordPress’ is closed to new replies.