We build a webapp that allows users to run the app under their own subdomain. So we run the app under search.domainX.com, search.domainY.com and so on. They each have their own Google Analytics to track individual stats. But we want to know what general traffic for all clients of our app. So we want to know stuff like "among all our clients we had x number of views." What is the best way tool to track that sort of thing. We prefer a snippet based solution similar to Google Analytics if possible.

  • We went with Quantcast for now. It gives us a good idea of our traffic across domains.
    – kidbrax
    Nov 8, 2011 at 14:57

3 Answers 3


You can send tracking data to multiple Analytics accounts using the asynchronous tracking API to send multiple commands. For example:

<script type="text/javascript">

  var _gaq = _gaq || [];

  //Send data to the client's Google Analytics account
  _gaq.push(['_setAccount', 'UA-12345-1']);

  //Send data to your Google Analytics account
  _gaq.push(['b._setAccount', 'UA-12345-2']);
  _gaq.push(['b._setDomainName', 'none']);
  _gaq.push(['b._setAllowHash', 'false']);
  _gaq.push(['b._setAllowLinker', true]);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);


This will send data to their Analytics account (UA-12345-1) for visits to that domain only, and it will send data to your Analytics account (UA-12345-2) for all sites using your app, so long as you include the code on every installation.

The best way to implement this would be to build Google Analytics into your app, and prompt users for their 'UA-12345-1' Analytics account code. That way, they won't have to add Analytics code themselves, which might risk messing up your setup.

You should also mention to them that you're tracking their usage of the app in order to improve your product, either directly or in your terms and conditions.


I assume that you have access to the servers behind the search.*.com domains. In that case you could just combine the log files for each domain into one big one. Then the question becomes "which is the best tool for getting stats out of log files?", which is a separate question!

  • Yes, we have access to the log files but I was hoping for a javascript based solution such as Google Analytics.
    – kidbrax
    Mar 17, 2011 at 19:25
  • In that case this article google.com/support/googleanalytics/bin/… will probably help. It tells you to add code for when you go between domains. I think that's so when you go from one to another it doesn't count as a new visitor in the domain you are going to. I would have thought in your case that doesn't apply. Mar 18, 2011 at 8:57

Piwik is an open source, user friendly web analytics free solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.