title: Google Analytics - Tracking Multiple Properties Including Parent
body: <p>I'm trying to setup tracking for multiple subdomain properties while also sending data to the main property. </p>
  
  <p>Right now, we have the following setup: </p>
  
  <p>domain.com - UA-XXX-1</p>
  
  <p>foo.domain.com - UA-XXX-2</p>
  
  <p>bar.domain.com - UA-XXX-3</p>
  
  <p>If a user visits the domain "foo.domain.com", I want there to be data sent to UA-XXX-1 and UA-XXX-2 for a pageview. From my understanding, I need to setup the GA code as such:</p>
  
  <pre><code>&lt;script&gt;
  (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-XXX-1', 'auto');
  ga('send', 'pageview');
  ga('create', 'UA-XXX-2', 'auto',{'name': 'Foo'});
  ga('Foo.send', 'pageview');
  &lt;/script&gt;
  </code></pre>
  
  <p>Setting this up for all subdomains as such would mean that if I go to UA-XXX-1, I will see a mixture of data from all the subdomain properties I've setup, and if I go into the individual ones, I'll only see data for those specific properties. Easy. </p>
  
  <p>However, what I'm trying to figure out is, if this the proper method to use when it comes to adding things like event/conversion tracking? </p>
  
  <p>If I had a link as such: </p>
  
  <pre><code>&lt;a href="teletubbies.com" onclick="ga('send','event','Teletubby','Tinkywinky','Click');"&gt;Teletubbies&lt;/a&gt;
  </code></pre>
  
  <p>This would only send the event to the UA-XXX-1 property, and not the second property UA-XXX-2 that was setup as well, correct? Does this mean, that for each tracking code I will need to add in two separate tracking codes just to send an event tracking or is there a simpler solution? </p>
  
  <pre><code>&lt;a href="teletubbies.com" onclick="ga('send','event','Teletubby','Tinkywinky','Click'); ga('Foo.send', 'event', 'videos', 'predators');"&gt;Teletubbies&lt;/a&gt;
  </code></pre>