• Resolved tyrsdei

    (@tyrsdei)


    Hi!
    I have one matomo setup at siteA.what/analytics
    It is working fine for site A.

    Tried to connect siteB.what to it… and I get a 403 Error… The connection seems to work fine, but on any actual page JS Console shows 403 error.

    This is what the test script reports

    WP-Piwik 1.0.19
    Mode: http
    
    Test 1/3: global.getPiwikVersion
    
    string(5) "3.5.1"
    
    array(2) {
      [0]=>
      string(317) "HTTP/1.1 200 OK
    Date: Mon, 25 Jun 2018 12:46:15 GMT
    Server: Apache/2.4.33 (cPanel) OpenSSL/1.0.2o mod_bwlimited/1.4 Phusion_Passenger/5.1.12
    X-Powered-By: PHP/7.1.18
    Cache-Control: must-revalidate
    Upgrade: h2,h2c
    Connection: Upgrade
    Transfer-Encoding: chunked
    Content-Type: application/json; charset=utf-8
    
    "
      [1]=>
      string(146) "https://siteA.what/analytics/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DAPI.getPiwikVersion%26idSite%3D3&token_auth=..."
    }
    
    Test 2/3: SitesManager.getSitesWithAtLeastViewAccess
    
    array(3) {
      [0]=>
      array(17) {
        ["idsite"]=>
        int(1)
        ["name"]=>
        string(26) "SiteA - Analytics"
        ["main_url"]=>
        string(31) "https://siteA.what/analytics"
        ["ts_created"]=>
        string(19) "2018-06-09 03:24:13"
        ["ecommerce"]=>
        int(0)
        ["sitesearch"]=>
        int(1)
        ["sitesearch_keyword_parameters"]=>
        string(0) ""
        ["sitesearch_category_parameters"]=>
        string(0) ""
        ["timezone"]=>
        string(16) "America/New_York"
        ["currency"]=>
        string(3) "USD"
        ["exclude_unknown_urls"]=>
        int(0)
        ["excluded_ips"]=>
        string(0) ""
        ["excluded_parameters"]=>
        string(0) ""
        ["excluded_user_agents"]=>
        string(0) ""
        ["group"]=>
        string(0) ""
        ["type"]=>
        string(7) "website"
        ["keep_url_fragment"]=>
        int(0)
      }
      [1]=>
      array(17) {
        ["idsite"]=>
        int(2)
        ["name"]=>
        string(14) "Site A"
        ["main_url"]=>
        string(21) "https://siteA.what"
        ["ts_created"]=>
        string(19) "2018-06-08 00:00:00"
        ["ecommerce"]=>
        int(0)
        ["sitesearch"]=>
        int(1)
        ["sitesearch_keyword_parameters"]=>
        string(0) ""
        ["sitesearch_category_parameters"]=>
        string(0) ""
        ["timezone"]=>
        string(16) "America/New_York"
        ["currency"]=>
        string(3) "USD"
        ["exclude_unknown_urls"]=>
        int(0)
        ["excluded_ips"]=>
        string(0) ""
        ["excluded_parameters"]=>
        string(0) ""
        ["excluded_user_agents"]=>
        string(0) ""
        ["group"]=>
        string(0) ""
        ["type"]=>
        string(7) "website"
        ["keep_url_fragment"]=>
        int(0)
      }
      [2]=>
      array(17) {
        ["idsite"]=>
        int(3)
        ["name"]=>
        string(20) "Site B"
        ["main_url"]=>
        string(32) "https://siteB.what"
        ["ts_created"]=>
        string(19) "2018-06-20 18:38:08"
        ["ecommerce"]=>
        int(1)
        ["sitesearch"]=>
        int(1)
        ["sitesearch_keyword_parameters"]=>
        string(0) ""
        ["sitesearch_category_parameters"]=>
        string(0) ""
        ["timezone"]=>
        string(16) "America/New_York"
        ["currency"]=>
        string(3) "USD"
        ["exclude_unknown_urls"]=>
        int(1)
        ["excluded_ips"]=>
        string(0) ""
        ["excluded_parameters"]=>
        string(0) ""
        ["excluded_user_agents"]=>
        string(0) ""
        ["group"]=>
        string(0) ""
        ["type"]=>
        string(7) "website"
        ["keep_url_fragment"]=>
        int(0)
      }
    }
    
    array(2) {
      [0]=>
      string(317) "HTTP/1.1 200 OK
    Date: Mon, 25 Jun 2018 12:46:16 GMT
    Server: Apache/2.4.33 (cPanel) OpenSSL/1.0.2o mod_bwlimited/1.4 Phusion_Passenger/5.1.12
    X-Powered-By: PHP/7.1.18
    Cache-Control: must-revalidate
    Upgrade: h2,h2c
    Connection: Upgrade
    Transfer-Encoding: chunked
    Content-Type: application/json; charset=utf-8
    
    "
      [1]=>
      string(169) "https://siteA.what/analytics/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DSitesManager.getSitesWithAtLeastViewAccess%26idSite%3D3&token_auth=..."
    }
    
    Test 3/3: SitesManager.getSitesIdFromSiteUrl
    
    array(1) {
      [0]=>
      array(1) {
        ["idsite"]=>
        int(3)
      }
    }
    
    array(2) {
      [0]=>
      string(317) "HTTP/1.1 200 OK
    Date: Mon, 25 Jun 2018 12:46:16 GMT
    Server: Apache/2.4.33 (cPanel) OpenSSL/1.0.2o mod_bwlimited/1.4 Phusion_Passenger/5.1.12
    X-Powered-By: PHP/7.1.18
    Cache-Control: must-revalidate
    Upgrade: h2,h2c
    Connection: Upgrade
    Transfer-Encoding: chunked
    Content-Type: application/json; charset=utf-8
    
    "
      [1]=>
      string(208) "https://siteA.what/analytics/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DSitesManager.getSitesIdFromSiteUrl%26idSite%3D3%26url%3Dhttps%3A%2F%2FsiteB.what&token_auth=..."
    }
    
    array(2) {
      ["global_settings"]=>
      array(65) {
        ["revision"]=>
        string(10) "2017101501"
        ["last_settings_update"]=>
        string(10) "1529520734"
        ["piwik_mode"]=>
        string(4) "http"
        ["piwik_url"]=>
        string(32) "https://siteA.what/analytics/"
        ["piwik_path"]=>
        string(0) ""
        ["piwik_user"]=>
        string(0) ""
        ["piwik_token"]=>
        string(3) "set"
        ["auto_site_config"]=>
        string(1) "1"
        ["default_date"]=>
        string(5) "today"
        ["stats_seo"]=>
        string(1) "0"
        ["stats_ecommerce"]=>
        string(1) "0"
        ["dashboard_widget"]=>
        string(5) "today"
        ["dashboard_ecommerce"]=>
        string(1) "0"
        ["dashboard_chart"]=>
        string(1) "0"
        ["dashboard_seo"]=>
        string(1) "0"
        ["toolbar"]=>
        string(1) "0"
        ["capability_read_stats"]=>
        array(12) {
          ["administrator"]=>
          string(1) "1"
          ["editor"]=>
          string(1) "0"
          ["author"]=>
          string(1) "0"
          ["contributor"]=>
          string(1) "0"
          ["subscriber"]=>
          string(1) "0"
          ["bbp_keymaster"]=>
          string(1) "0"
          ["bbp_spectator"]=>
          string(1) "0"
          ["bbp_blocked"]=>
          string(1) "0"
          ["bbp_moderator"]=>
          string(1) "0"
          ["bbp_participant"]=>
          string(1) "0"
          ["wpseo_manager"]=>
          string(1) "0"
          ["wpseo_editor"]=>
          string(1) "0"
        }
        ["perpost_stats"]=>
        string(1) "0"
        ["plugin_display_name"]=>
        string(8) "WP-Piwik"
        ["piwik_shortcut"]=>
        string(1) "0"
        ["shortcodes"]=>
        string(1) "0"
        ["track_mode"]=>
        string(2) "js"
        ["track_codeposition"]=>
        string(6) "footer"
        ["track_noscript"]=>
        string(1) "0"
        ["track_nojavascript"]=>
        string(1) "0"
        ["proxy_url"]=>
        string(26) "//siteA.what/analytics/"
        ["track_content"]=>
        string(8) "disabled"
        ["track_search"]=>
        string(1) "1"
        ["track_404"]=>
        string(1) "1"
        ["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) ""
        ["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(0) {
        }
        ["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"
        ["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"
        ["update_notice"]=>
        string(7) "enabled"
      }
      ["settings"]=>
      array(6) {
        ["name"]=>
        string(0) ""
        ["site_id"]=>
        string(1) "3"
        ["noscript_code"]=>
        string(120) "<noscript><p><img src="//siteA.what/analytics/js/index.php?idsite=3&rec=1" style="border:0;" alt="" /></p></noscript>"
        ["tracking_code"]=>
        string(620) "<!-- Matomo -->
    <script type="text/javascript">
      var _paq = _paq || [];
      /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
      _paq.push(['trackPageView']);
      _paq.push(['enableLinkTracking']);
      (function() {
        var u="//siteA.what/analytics/";
        _paq.push(['setTrackerUrl', u+'js/index.php']);
        _paq.push(['setSiteId', '3']);
        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
        g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'js/index.php'; s.parentNode.insertBefore(g,s);
      })();
    </script>
    <!-- End Matomo Code -->
    "
        ["last_tracking_code_update"]=>
        string(10) "1529520734"
        ["dashboard_revision"]=>
        string(1) "0"
      }
    }
    

    This is an example of an error I get on the page.

    index.php:1 GET https://siteA.what/analytics/js/index.php?action_name=Home%20%E2%80%93%20Site%20B&idsite=3&rec=1&r=264032&h=9&m=6&s=36&url=https%3A%2F%2FsiteB.what%2F&urlref=https%3A%2F%2FsiteB.what%2Fcontact%2F&_id=98203a599468d5c1&_idts=1529890180&_idvc=2&_idn=0&_refts=0&_viewts=1529929270&send_image=1&pdf=1&qt=0&realp=0&wma=0&dir=0&fla=0&java=0&gears=0&ag=0&cookie=1&res=1536x864&gt_ms=1669&pv_id=ne0KnF 403 (Forbidden)
    Image (async)
    ch @ index.php:44
    (anonymous) @ index.php:45
    cs @ index.php:45
    bw @ index.php:45
    bR @ index.php:52
    (anonymous) @ index.php:67
    b8 @ index.php:57
    Q.trackPageView @ index.php:67
    ac @ index.php:23
    aa @ index.php:71
    addTracker @ index.php:72
    (anonymous) @ index.php:75
    (anonymous) @ index.php:75

    I feel like I may be missing something obvious… but I’m not quite sure.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter tyrsdei

    (@tyrsdei)

    It’s weird… it seems to be working for when the theme developer accesses the site… but not any of my team?

    • This reply was modified 6 years, 8 months ago by tyrsdei.
    Thread Starter tyrsdei

    (@tyrsdei)

    I have statistics of them visiting
    could mod security rule 1234234 on SiteA have something to do with it?

    • This reply was modified 6 years, 8 months ago by tyrsdei.
    Plugin Author braekling

    (@braekling)

    The URL looks quite strange.

    https://siteA.what/analytics/js/index.php?action_name=Home%20%E2%80%93%20Site%20B&idsite=3&rec=1&r=264032&h=9&m=6&s=36&url=https%3A%2F%2FsiteB.what%2F&urlref=https%3A%2F%2FsiteB.what%2Fcontact%2F&_id=98203a599468d5c1&_idts=1529890180&_idvc=2&_idn=0&_refts=0&_viewts=1529929270&send_image=1&pdf=1&qt=0&realp=0&wma=0&dir=0&fla=0&java=0&gears=0&ag=0&cookie=1&res=1536x864&gt_ms=1669&pv_id=ne0KnF

    Seems to be the tracking pixel, but contains a lot of additional parameters. Did you try to open it via browser? To understand why you get a forbidden (e.g. because of mod_security or some htaccess configurations), it may helpful to have a look at your server logfiles. Especially if access is blockd because of mod_security this event should be mentioned there.

    If it’s actually the tracking pixel, then it also makes sense that tracking works anyway, because normally the tracking is done via JavaScript… the pixel is used as a fallback only. You should also check if you really need a tracking pixel, or if JavaScript tracking is completely adaquate (it is in most use cases).

    Thread Starter tyrsdei

    (@tyrsdei)

    It does seem to be an issue with modSecurity rules. Sorry for the late reply, I have been trying to get it sorted. I think it is sorted now, I’ve been on vacation so I haven’t checked, but it said today when I checked that I had 14 unique visitors. So all seems well, thanks for the tip, it was helpful to look in the server logs ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘403 Forbidden error, 2 sites, 1 Matomo’ is closed to new replies.