On piwik, I use localhost as a test website. When I type in localhost from my computer, piwik updates its statistics correctly but when another person (co-worker) in the same LAN types in my IP address, it shows the webpage but piwik doesn't update the visits/pageview count. I would like to know why is that? Any help would be appreciated.
3 Answers
You need to add your IP to the trusted_hosts[]
configuration. If you installed Piwik under localhost, it will only accept tracking requests if called under that name.
In config.ini.php
add:
[General]
trusted_hosts[] = localhost
trusted_hosts[] = 192.168.1.12
Where 192.168.1.12
is your IP address within your LAN:

- 33,545
- 8
- 78
- 87
-
1As far as I've understood, trusted_hosts is here to allow calls from some hosts, and reject other ones from anywhere else. But I state it do not act as it is expected to act, see this issue I've opened : https://github.com/piwik/piwik/issues/5831 and also this post http://forum.piwik.org/read.php?2,105997,118020#msg-118020 What do you think about that ? – Oliver Jul 18 '14 at 00:01
This config
[General]
trusted_hosts[] = localhost
says on which address you can access Piwik, its admin panel. If you want to track LAN page you have to modify its Tracking code. To get right for you tracking code (it will not work if you have dynamic IP in your network):
- add to
trusted_hosts
IP address you have in LAN - enter Piwik Admin Panel not by
localhost
but by your LAN address eg.192.168.1.12
- Now all tracking codes will have your IP as server address and will fire requests to your computer where Piwik is installed.
Explaination:
This all happens because when you enter Piwik Admin Panel from your localhost
all tracking codes will have localhost
as you Piwik address. So if somebody enters webpage with tracking code, browser will try to communicate with user localhost
which is: His Computer. and probably he doesn't have your Piwik.

- 4,026
- 3
- 23
- 29
I added these into config.ini.php as @halfdan said.
[General]
trusted_hosts[] = localhost
trusted_hosts[] = 192.168.1.12
Also change (localhost) website URL mapping.
Click on Setting Icon -> Websites -> Manage
Click on desire website Edit Icon (in my case its localhost)
Change URLs fields from localhost to 192.168.1.12

- 509
- 3
- 16