Hi,
First: I’m really new to Piwik
I was planning if I would use Piwik with async tag so that it would add pageview to two websites (one being the whole server, and the other the current website).
Async api has setSiteId, can that be called multiple times and trackPageView also? If it can, what happens if there is some setCustomVariable/setDocumentTitle/setCookieDomain/setDomains calls before that?
If this question is hard to understand I’ll give a javascript example, would this work:
var _paq = _paq || [];
(function(){
var u=(("https:" == document.location.protocol) ? "https://stats.example.org/" : "http://stats.example.org/");
// global websiteid
_paq.push(["setSiteId", 19]);
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setCustomVariable", "1", "sex", "1", "page"]);
_paq.push(["setCustomVariable", "2", "age", "3", "page"]);
_paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
_paq.push(["setCookieDomain", "*.example.org"]);
_paq.push(["setDomains", "*.example.org"]);
if (!window.location.pathname.match(/^\/(admin|radmin)\//))
{
_paq.push(["trackPageView"]);
}
// current sites websiteid
_paq.push(["setSiteId", 4142]); // did this reset custom variables etc?
_paq.push(["setTrackerUrl", u+"piwik.php"]);
if (!window.location.pathname.match(/^\/(admin|radmin)\//))
{
_paq.push(["trackPageView"]);
}
// link tracking, what should this do? for last one? or both?
_paq.push(["enableLinkTracking"]);
var d=document,
g=d.createElement("script"),
s=d.getElementsByTagName("script")[0];
g.type="text/javascript";
g.defer=true;
g.async=true;
g.src=u+"piwik.js";
s.parentNode.insertBefore(g,s);
})();
And if it isn’t possible, would it be possible in future? Or is there a some other way to archive what I’m trying to do. Like having websites which have “subwebsites” or something.
The goal is to get whole server statistics to one login(user) and each individual website can also have a one login(user) to see those statistics.
I don’t think it would be so nice to have the whole server login(user) to have access to all the other websites in the server and there isn’t any combined reports, or are there? But I know that this way would be possible to implement.