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
Hardcoded
<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','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXXXX-Y', 'auto');
ga('send', 'pageview');
</script>
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.