How to: Internet visits to intranet Piwik through DMZ?

Hi we have an intranet Piwik installation that works like a charm.

Our company als has an internet website which we would like to trac but we have a secure intranet and our policy demands we cant have any non-static data on the internet, so we cant put a piwik installation on our internet server.

Our internet and intranet is separated by a DMZ with a, lets call it, transport solution.

I am designing a workable solution to register visits on our internet website in our intranet Piwik installation. This is requiring a ‘middle-man’ script of some kind on a secure server in the DMZ which can communicate between both internet and intranet. The internet visitor posts (piwik.php call) to this middle-man script, this script stores the ‘request’ and posts this request tot the intranet Piwik install.

Question: Is all the user data located in the GET params of the Piwik.php call the tracker code does? If so, i can create a ‘forward’ script of some kind.

If not, what additional scripts would I require on the DMZ server? Is there some kind of documentation what is (files, code) required or used when a visitor visits a website that is tracked by Piwik and ‘submits’ its info?

Thank you in advance.

You need to also forward the IP address (using cip parameter), HTTP header accept-language.

Thanks! Also found useful information in the API docs. I am going to make a script which will ‘capture’ the logs that piwik.php would normally capture for the internet visitors, save those entries with additional IP and lang settings and make an api call to our intranet through a BlueCoat proxy to save them in the intranet Piwik installation.

Can you explain exactly how you’ve done that? I’m in the exact same situation where i want to track my internet website with piwik in my intranet.

I’m using IIS7.5 with BlueCoat


I’m going to create a custom script on an outside hardened webserver that caputures the ‘posts’ to piwik, ads the lang and ip settings and stores the requests.

Another scripts / account on the outside server will then ‘forward’ the request by calling the Piwik API on the internet server through, in our case also, bluecoat.

I haven’t come around to the implementation but in theory it should work.

maybe another solution for a future piwik release would be to separate the piwik stats service and the administration web site. That way, we would be able to install the service anywhere we want (intranet, extranet, etc…) with only the DB ConnectionString in the config file.