2

Each user on our website has their own subdomain (e.g. bob.example.com, elephant.example.com) and they get paid for the traffic that they send to this subdomain. How can I wire up Google Analytics so that I can view statistics (views, countries, browsers, etc) for each domain seperately? I'm not sure if this is an Analytics JS code thing, or if it tracks already and I am unable to find it in the GUI

My current Google Analytics code is this

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-123456-1', 'example.com');
  ga('send', 'pageview');

</script>

Any assistance would be extremely appreciated, thank you.

Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47
Mark Gladstone
  • 155
  • 1
  • 2
  • 6

1 Answers1

3

According to the Google Developers guide, you don't have to set up multiple code snippets for each site, as long as they share the same top level domain:

Google Developer's Guide

Here's a good article on displaying subdomains in the dashboard.

symlynk
  • 176
  • 6