• Resolved barthat

    (@barthat)


    I have been using Piwik and this plugin for a couple of years now and it has worked very well. Thankyou for you developing the plugin and your continued support.

    I have started using Cloudflare with the Flexible SSL feature enabled (plus the Cloudflare plugin) and Piwik is no longer tracking visits.

    My site is not accessed via https:\\mydomain.com and both http and www variants are redirected to that.

    Here is the output from WP-Piwik debug

    WP-Piwik 1.0.5
    Mode: http
    
    Test 1/3: global.getPiwikVersion
    
    string(6) "2.15.0"
    
    array(2) {
      [0]=>
      string(786) "HTTP/1.1 200 OK
    Server: cloudflare-nginx
    Date: Sun, 25 Oct 2015 08:51:54 GMT
    Content-Type: application/json; charset=utf-8
    Content-Length: 10
    Connection: keep-alive
    Set-Cookie: __cfduid=dcff6b0c5a666179b3b2393179ec45f101445763113; expires=Mon, 24-Oct-16 08:51:53 GMT; path=/; domain=.mydomain.com; HttpOnly
    Cache-Control: private, no-store, no-cache, must-revalidate, proxy-revalidate, no-transform, max-age=0
    Expires: Mon, 26 Oct 2015 08:51:54 GMT
    Expires:
    Cache-Control: must-revalidate
    X-Frame-Options: SAMEORIGIN
    X-XSS-Protection: 1;mode=block
    Vary: User-Agent
    X-Content-Type-Options: nosniff
    Access-Control-Allow-Origin: https://mydomain.com
    Imagetoolbar: no
    X-UA-Compatible: IE=edge,chrome=1
    X-Turbo-Charged-By: LiteSpeed
    CF-RAY: 23acaea3892f2519-ORD
    
    "
      [1]=>
      string(148) "https://piwik.mydomain.com/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DAPI.getPiwikVersion%26idSite%3D1&token_auth=..."
    }
    
    Test 2/3: SitesManager.getSitesWithAtLeastViewAccess
    
    array(1) {
      [0]=>
      array(17) {
        ["idsite"]=>
        string(1) "1"
        ["name"]=>
        string(13) "My Site Name"
        ["main_url"]=>
        string(22) "http://mydomain.com"
        ["ts_created"]=>
        string(19) "2013-07-27 04:31:00"
        ["ecommerce"]=>
        string(1) "0"
        ["sitesearch"]=>
        string(1) "1"
        ["sitesearch_keyword_parameters"]=>
        string(0) ""
        ["sitesearch_category_parameters"]=>
        string(0) ""
        ["timezone"]=>
        string(16) "Europe/Stockholm"
        ["currency"]=>
        string(3) "USD"
        ["exclude_unknown_urls"]=>
        string(1) "1"
        ["excluded_ips"]=>
        string(11) "77.53.205.*"
        ["excluded_parameters"]=>
        string(0) ""
        ["excluded_user_agents"]=>
        string(0) ""
        ["group"]=>
        string(0) ""
        ["type"]=>
        string(7) "website"
        ["keep_url_fragment"]=>
        string(1) "0"
      }
    }
    
    array(2) {
      [0]=>
      string(787) "HTTP/1.1 200 OK
    Server: cloudflare-nginx
    Date: Sun, 25 Oct 2015 08:51:54 GMT
    Content-Type: application/json; charset=utf-8
    Content-Length: 425
    Connection: keep-alive
    Set-Cookie: __cfduid=df4d67a2785d3e307c80bd9f3aada0af31445763114; expires=Mon, 24-Oct-16 08:51:54 GMT; path=/; domain=.mydomain.com; HttpOnly
    Cache-Control: private, no-store, no-cache, must-revalidate, proxy-revalidate, no-transform, max-age=0
    Expires: Mon, 26 Oct 2015 08:51:54 GMT
    Expires:
    Cache-Control: must-revalidate
    X-Frame-Options: SAMEORIGIN
    X-XSS-Protection: 1;mode=block
    Vary: User-Agent
    X-Content-Type-Options: nosniff
    Access-Control-Allow-Origin: https://mydomain.com
    Imagetoolbar: no
    X-UA-Compatible: IE=edge,chrome=1
    X-Turbo-Charged-By: LiteSpeed
    CF-RAY: 23acaeaa451309ac-ORD
    
    "
      [1]=>
      string(171) "https://piwik.mydomain.com/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DSitesManager.getSitesWithAtLeastViewAccess%26idSite%3D1&token_auth=..."
    }
    
    Test 3/3: SitesManager.getSitesIdFromSiteUrl
    
    array(1) {
      [0]=>
      array(1) {
        ["idsite"]=>
        string(1) "1"
      }
    }
    
    array(2) {
      [0]=>
      string(786) "HTTP/1.1 200 OK
    Server: cloudflare-nginx
    Date: Sun, 25 Oct 2015 08:51:55 GMT
    Content-Type: application/json; charset=utf-8
    Content-Length: 18
    Connection: keep-alive
    Set-Cookie: __cfduid=d920e0bdda48644b5686aa51e56f359f41445763114; expires=Mon, 24-Oct-16 08:51:54 GMT; path=/; domain=.mydomain.com; HttpOnly
    Cache-Control: private, no-store, no-cache, must-revalidate, proxy-revalidate, no-transform, max-age=0
    Expires: Mon, 26 Oct 2015 08:51:55 GMT
    Expires:
    Cache-Control: must-revalidate
    X-Frame-Options: SAMEORIGIN
    X-XSS-Protection: 1;mode=block
    Vary: User-Agent
    X-Content-Type-Options: nosniff
    Access-Control-Allow-Origin: https://mydomain.com
    Imagetoolbar: no
    X-UA-Compatible: IE=edge,chrome=1
    X-Turbo-Charged-By: LiteSpeed
    CF-RAY: 23acaeac0d8a10e1-ORD
    
    "
      [1]=>
      string(201) "https://piwik.mydomain.com/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DSitesManager.getSitesIdFromSiteUrl%26idSite%3D1%26url%3Dhttps%3A%2F%2Fmydomain.com&token_auth=..."
    }
    
    array(2) {
      ["global_settings"]=>
      array(57) {
        ["revision"]=>
        string(10) "2015101201"
        ["last_settings_update"]=>
        string(10) "1445715510"
        ["piwik_mode"]=>
        string(4) "http"
        ["piwik_url"]=>
        string(34) "https://piwik.mydomain.com/"
        ["piwik_path"]=>
        string(37) "/home/username/public_html/piwik/"
        ["piwik_user"]=>
        string(0) ""
        ["piwik_token"]=>
        string(3) "set"
        ["auto_site_config"]=>
        string(1) "0"
        ["default_date"]=>
        string(12) "current_week"
        ["stats_seo"]=>
        string(1) "0"
        ["dashboard_widget"]=>
        string(5) "today"
        ["dashboard_chart"]=>
        string(1) "1"
        ["dashboard_seo"]=>
        string(1) "0"
        ["toolbar"]=>
        string(1) "0"
        ["capability_read_stats"]=>
        array(5) {
          ["administrator"]=>
          string(1) "1"
          ["editor"]=>
          string(1) "0"
          ["author"]=>
          string(1) "0"
          ["contributor"]=>
          string(1) "0"
          ["subscriber"]=>
          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) "1"
        ["track_nojavascript"]=>
        string(1) "0"
        ["proxy_url"]=>
        string(28) "//piwik.mydomain.com/"
        ["track_content"]=>
        string(8) "disabled"
        ["track_search"]=>
        string(1) "0"
        ["track_404"]=>
        string(1) "0"
        ["add_post_annotations"]=>
        string(1) "0"
        ["add_customvars_box"]=>
        string(1) "0"
        ["add_download_extensions"]=>
        string(0) ""
        ["set_download_extensions"]=>
        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(4) {
          ["administrator"]=>
          string(1) "1"
          ["editor"]=>
          string(1) "1"
          ["author"]=>
          string(1) "1"
          ["contributor"]=>
          string(1) "1"
        }
        ["track_across"]=>
        string(1) "0"
        ["track_across_alias"]=>
        string(1) "0"
        ["track_feed"]=>
        string(1) "0"
        ["track_feed_addcampaign"]=>
        string(1) "0"
        ["track_feed_campaign"]=>
        string(4) "feed"
        ["track_heartbeat"]=>
        string(2) "30"
        ["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"
        ["piwik_useragent"]=>
        string(3) "php"
        ["piwik_useragent_string"]=>
        string(8) "WP-Piwik"
        ["track_datacfasync"]=>
        string(1) "1"
        ["track_cdnurl"]=>
        string(0) ""
        ["track_cdnurlssl"]=>
        string(0) ""
        ["force_protocol"]=>
        string(5) "https"
        ["update_notice"]=>
        string(7) "enabled"
      }
      ["settings"]=>
      array(6) {
        ["name"]=>
        string(0) ""
        ["site_id"]=>
        string(1) "1"
        ["noscript_code"]=>
        string(120) "<noscript><p><img src="//www.piwik.mydomain.com/js/index.php?idsite=1" style="border:0;" alt="" /></p></noscript>"
        ["tracking_code"]=>
        string(0) ""
        ["last_tracking_code_update"]=>
        string(1) "0"
        ["dashboard_revision"]=>
        string(1) "0"
      }
    }

    Two things stand out

    1) the references to http instead of https
    2) the http://www.piwik.mydomain.com uri – the uri should not contain www.

    In contrast the tracking code in Piwik is

    <!-- Piwik -->
    <script type="text/javascript">
      var _paq = _paq || [];
      _paq.push(['trackPageView']);
      _paq.push(['enableLinkTracking']);
      (function() {
        var u="//piwik.mydomain.com/";
        _paq.push(['setTrackerUrl', u+'piwik.php']);
        _paq.push(['setSiteId', 1]);
        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+'piwik.js'; s.parentNode.insertBefore(g,s);
      })();
    </script>
    <noscript><p><img src="//piwik.mydomain.com/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
    <!-- End Piwik Code -->

    and

    <!-- Piwik Image Tracker-->
    <img src="https://piwik.mydomain.com/piwik.php?idsite=1&rec=1" style="border:0" alt="" />
    <!-- End Piwik -->

    In the url list in Piwik – Manage Web Sites I have listed both the http and https urls and some aliases.

    https://wordpress.org/plugins/wp-piwik/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author braekling

    (@braekling)

    Can you please try this URL:

    https://PIWIK.EXAMPLE.COM/index.php?module=API&method=SitesManager.getJavascriptTag&idSite=YOUR_SITE_ID&piwikUrl=&format=xml&token_auth=YOUR_AUTH_TOKEN
    (add your domain, site ID & auth token)

    You should get the tracking code… does it contain the www?

    Thread Starter barthat

    (@barthat)

    I think I may have found the problem. Your mention of auth token led me to it. I have recently moved webhost (at same time I started using Cloudflare) and it seems that in the process the auth token has changed. WP-Piwik was showing that I was connected even though the auth token in WP-Piwik was different to what was now displayed in Piwik / API.

    When I check the url using the correct auth token the tracking code returned does not contain www. I have just tested from a browser with DNT disabled from an unknown IP (to Piwik) and it seems to working ok now.

    Thanks for your help.

    Plugin Author braekling

    (@braekling)

    Great, nice to hear. Maybe WP-Piwik still showed a successful connection because of its caching… I think I have to dig into that again.

    Thread Starter barthat

    (@barthat)

    Yes, by the way re caching I have /had Cloudflare caching disabled on the wp-admin pages just in case you were wondering.

    I did notice that the WP-Piwik connection wasn’t working normally e.g. I’d got into the tab to check the tracking code and there was none there. But if I went to another tab in WP-Piwik and back again the tracking code appeared. I never thought to check the auth token.

    Thread Starter barthat

    (@barthat)

    I just noticed a typo in my original post

    My site is not accessed via https:\\mydomain.com

    should be

    My site is accessed via https:\\mydomain.com

    Oh, and previously my site was at www so it indeed could be some kind of caching related issue.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Not tracking when behind Cloudflare with Flexible SSL’ is closed to new replies.