Piwik Tracking Issues


#1

Hello, I have a question about the piwik tracking code that is given to me. It appears that I can only track my main computer and not anyone else. Here is my code below. My intranet site is called Harold.local

Is there any thing wrong with it? Thank You


(Steve Mercer) #2

There is no code. Did you use the “Preformatted text” option in the forum? Or perhaps you forgot to paste the code?


#3

Hello, I have a question about the piwik tracking code that is given to me. It appears that I can only track my main computer and not anyone else. Here is my code below. My intranet site is called Harold.local

script type=“text/javascript"
var _paq = _paq || [];
_paq.push([“setDocumentTitle”, document.domain + “/” + document.title]);
_paq.push([“setDomains”, [”*.harold.local"]]);
_paq.push([‘trackPageView’]);
_paq.push([‘enableLinkTracking’]);
(function() {
var u="//localhost:8080/piwik/";
_paq.push([‘setTrackerUrl’, u+‘piwik.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+‘piwik.js’; s.parentNode.insertBefore(g,s);
})();

Is there any thing wrong with it? Thank You


(Steve Mercer) #4

The problem is localhost. On your machine there is a web server running on port 8080, correct? When this page is loaded on your machine it finds /piwik/piwik.php. When the page is loaded on a different machine there is no web site running so piwik.php does not exist.

You could try using the ip address of your machine rather than localhost. What do other users use to get to the web site?


#5

Well the employees will use http://harold.local to get to the site. Would that be the issue?


(Steve Mercer) #6

You would need to change the line that reads

var u="//localhost:8080/piwik/";

to

var u="//harold.local:8080/piwik/";

so that other users will be tracked.


#7

I just tried it but it still isn’t working.


#8

Why do you need to setDomains in the code? I use a different SiteId for local development, qa, production, etc as needed. Keep your stats separated. Use Piwik admin to list your domain URLs that should be tracked (if you even care)…


(Steve Mercer) #9

Do your other users use port 8080? if the URL is just harold.local without a port you will need to remove the port from the javascript code.

var u="//harold.local/piwik/";

Also, is the Piwik code in the piwik directory? What is the URL to get to the Piwik dashboard?


(Palala) #10

Hi,

I would like ask you where to put it this piece of code ?
thanks for you help