:SDo not count visitors to https page?


#1

Hello,
I start with am completely new to Piwik (:P)

I’ve started counting visitors, which works on http pages but when I try to count visitors who are on my https pages, so it refuses to count visitors and i don’t now why.

My web server is nginx, and pages with https i force users to visit it with https and not http. I do this with.


         # Base configuration
         listen 80;
         listen [::]:80  default ipv6only=on;
    server_name the-site.com www.the-site.com;
    rewrite ^(.*) https://www.the-site.com $1 permanent;

         listen [::]:443  default ipv6only=on;
         listen 443;

In my php code for this site i have add the code to count visitors.


<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
  _paq.push(["setCookieDomain", "*.www.the-site.com"]);
  _paq.push(["setDomains", ["*.www.the-site.com","*.the-site.com"]]);
  _paq.push(["trackPageView"]);
  _paq.push(["enableLinkTracking"]);

  (function() {
    var u=(("https:" == document.location.protocol) ? "https" : "http") + "://visitors.site.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.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
  })();
</script>
<!-- End Piwik Code -->

The script don’t count the visitors to my https sites, see attached image.

Does anyone know what might be wrong and how I fix it?


(Matthieu Aubry) #2

Go to your site over https, and debug the tracking call as explained in http://piwik.org/docs/tracking-api/reference/#toc-debugging-the-tracking-api-requests


#3

Hey imgo,

I was having the same issue for my site at http://equityzen.com, but Matt’s instructions helped me fix this! Thank you for the help Matt!

Best,
Bob


#4

Does your piwik domain also answer on https? By default the javascript tells it to access your piwik installation using the same method it access the site. I made a simple edit to the javascript to disable this and have it use http only as I do not run ssl on my piwik install.