New to piwik and question


Hi All,

I’m new to Piwik and I’m trying to set it up for my site to test its features. So far I’v liked it so much, as it seems quite simple to use.

On the other hand I’ve run into a problem, that I have no idea how to solve:

My site runs on three different subdomains:

Over the first one I have full control so I have added the tracking code and it works fine. The other two are run by a provider of us, that does not allow us to change code directly (we can ask them, but changes will take long), but they allow us to make changes via javascript (in both those domains pages there is a call to a javascript file in the domain we control):

<script type='text/javascrtip' src='></script>

That is, we can can make changes remotely in that site using javascript hosted in the domain we control.

So in order to have those subdomains tracked, I have saved the piwik javascript tracking code to a file named piwik_analytics.js (removing the tags) and I’ve done this in that patch.js file:

var ka = document.createElement('script');
ka.type = 'text/javascript'; = 'header_script';
ka.src = (document.location.protocol === 'https:' ? 'https://' : 'http://') + '';
var a = document.getElementsByTagName('head')[0].appendChild(ka, a);

According browser console it seems that now, when I load a page in any of those subdomains, both piwik_analytics.js and the piwik.js file in the piwik server are loaded. In fact I added a console.log line in the piwik.js file and the log appears, so it’s being executed.

Despite of that, I can’t find any entries in the piwik reports related to those subdomains, other than referals.

After the piwik.js is being loaded, I also see in the browser console this call is being made (i have replaced the URL for privacy, but instead of that “” there was a long URL in the domain, apparently URLEncoded)

In the website settings I have added and in the URLs field of my site, though I think that won’t help.

Finally, to check if code is working, I have made a segment, filtering by Page URL containing or, but once aplied piwik says there is no data for that segment.

I know properly adding the code in the HTML code of the site would be the best way to do it, but that would mean it would have to be added to next sprint in our provider pipeline and I won’t be able to test until 2-3 weeks have passed.


Hmmm… Nevermind, 24h later both segments are populated with data. Somehow I though data was visible inmediatly.