PIWIK and Cloudflare using one dynamic ip not working – now half fixed

Preamble
I noticed when I started using Cloudflare I was not getting any hits in piwik.
Actually it was a bit strange…

  • on my local network I could get hits
  • My mobile phone generates hits
  • No hits appeared to be coming through any Cloudflare CDN

     
    Solution
    To fix the issue I made the dns at Cloudflare look like

  • CNAME brombo.co.uk => dynamic ip address
  • CNAME wwww => brombo.co.uk
  • CNAME piwik => dynamic ip address
  •  
    Investigation
    I strongly suspected that it was a caching issue as that is what CDN does.
    I tried turning off caching on Cloudflare, but this didn’t fix the issue.
    The solution appears to be to separate your web ip, from you piwik ip in the dns.

    Initially I had

  • www.brombo.co.uk as my website
  • www.brombo.co.uk/piwik as my piwik site
  • Hence they share the same root website, and I suspect my tracking java code was being redirected to the wrong ip.

    I then changed my sites to

  • www.brombo.co.uk – website
  • piwik.brombo.co.uk – piwik site, via adding a dns entry/virtual host
  •  
    This still didn’t fix it as my dns looked something like this

  • CNAME brombo.co.uk => dynamic ip address
  • CNAME wwww => brombo.co.uk
  • CNAME piwik => brombo.co.uk
  •  
    I suspect Cloudfare just breaks the alias at brombo.co.uk hence piwik.brombo.co.uk still didn’t work.

    To fix the issue I made the dns at Cloudflare look like

  • CNAME brombo.co.uk => dynamic ip address
  • CNAME wwww => brombo.co.uk
  • CNAME piwik => dynamic ip address
  •  
    Now I see to be able to generate hits using
    https://www.geoscreenshot.com/capture
     
    ToDo
    I have tried using the piwik app on Cloudflare but this currently doesn’t appear to generate any hits for me. Also the ip addresses I am currently receiving I believe are actually Cloudflare ones… I need to add the mod to the synology to fix this.

    Leave a Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.