Basically I have a Heroku app on a main domain and a wordpress blog on a subdomain as blog.maindomain.com. I have google tag manager installed on the herokuapp that tracks the main domain.

How am I able to also allow my wordpress to have the same functionality? I want to be able to view all the analytics in a single account.

EDIT: I don't have to use GTM on the wordpress website, just as long as the data is showing on the same GA account.


2 Answers 2


From your question it isn't very clear if you have GTM deployed on wordpress already or not. If not, get it on there via a plugin or by editing the template code to add the GTM code.

GTM Version

As far as getting sudomain.domain.com traffic to appear in the same analytics view, you need to use the same UA code in Tracking ID field of the the pageview tag in GTM and modify one thing. Specifically under More Settings --> Fields to Set add an entry with cookieDomain as the Field Name and auto as the Value. This will cause google to push pageviews to the same Google Analytics Account and event connect the same session since the cookieDomain auto part will cause GTM to set the analytics cookie to the highest domain it can which on sudomain.domain.com will resolve to domain.com


  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

  ga('create', 'UA-XXXXXXXX-Y', 'auto');
  ga('send', 'pageview');


The cookieDomain part is in this line ga('create', 'UA-XXXXXXXX-Y', 'auto'); with the UA code being the same you use on the domain.com site.


There's quite a few different plugins available that help you install Google Tag Manager on your Wordpress website. You can check out just a few of them here:


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.