New to piwik and question


#1

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='http://www.xxxx.com/js/patch.js></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';
ka.id = 'header_script';
ka.src = (document.location.protocol === 'https:' ? 'https://' : 'http://') + 'www.xxxx.com/js/piwik_analytics.js';
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 “http%3A%2F%2Fother.xxxx.com” there was a long URL in the other.xxxx.com domain, apparently URLEncoded)


http://piwik.xxxx.com/piwik/piwik.php?action_name=&idsite=1&rec=1&r=885606&h=12&m=56&s=49&url=http%3A%2F%2Fother.xxxx.com&_id=b59181e99d5eb548&_idts=1425636733&_idvc=1&_idn=0&_refts=0&_viewts=1425636733&send_image=0&pdf=1&qt=0&realp=0&wma=1&dir=0&fla=1&java=1&gears=0&ag=1&cookie=1&res=1920x1080&gt_ms=213

In the website settings I have added other.xxxx.com and secure.yyyy.com 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 other.xxxx.com or secure.yyyy.com, 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.


#2

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