{"id":5146738,"date":"2014-07-31T10:58:52","date_gmt":"2014-07-31T10:58:52","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/google-analytics-settings-for-subdomains-tracking\/"},"modified":"2016-08-21T23:47:28","modified_gmt":"2016-08-21T23:47:28","slug":"google-analytics-settings-for-subdomains-tracking","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/google-analytics-settings-for-subdomains-tracking\/","title":{"rendered":"Google Analytics settings for subdomains tracking"},"content":{"rendered":"<p>Hello to everyone, this is my first question (kind of a newbie here :-D).<\/p>\n<p>I have a website that spans over 4 subdomains + the main domain and I&#8217;d like to have a place where I can see the total page views, events and goal completions. Main domain is langhe.net, and subdomains are eventi.langhe.net, servizi.langhe.net, shop.langhe.net, about.langhe.net.<\/p>\n<p>The website is based on wordpress and I&#8217;m using google analytics for wordpress by yoast as analytics plugin.<\/p>\n<p>The configuration of the plugin is as follows:<\/p>\n<ul>\n<li>all the website have the same UA-XXXXXXXX code<\/li>\n<li>The Subdomain Traking field (setDomainName) is filled with .langhe.net<\/li>\n<li>Cross-Domain tracking is enabled<\/li>\n<li>Cross-Domain Primary Domain (setDomainName) is langhe.net<\/li>\n<li>Cross-Domain Tracking, Other Domains field is filled with: about.langhe.net, eventi.langhe.net, servizi.langhe.net, \tshop.langhe.net.<\/li>\n<\/ul>\n<p>In the GA property I&#8217;ve created an Advanced Custom Filter configured this way:<\/p>\n<ul>\n<li>Field A -&gt; Extract A = hostname (.*)<\/li>\n<li>Field B -&gt; Extract B = request URI (.*)<\/li>\n<li>Output To -&gt; Constructor = request URI $A1$B1<\/li>\n<li>Field A Required: yes<\/li>\n<li>Field B Required: No<\/li>\n<li>Override Output Field: yes<\/li>\n<li>Case Sensitive: no<\/li>\n<\/ul>\n<p>I was wondering it this is the best way of doing it, or if there are other &#8220;best practice&#8221; ways to obtain what I&#8217;m looking for (for example with this configuration it&#8217;s become quite difficult to separate the traffic sources for each website).<\/p>\n<p>Thank you in advance \ud83d\ude42<br \/>\nCheers!<\/p>\n<p>https:\/\/wordpress.org\/plugins\/google-analytics-for-wordpress\/<\/p>\n","protected":false},"template":"","class_list":["post-5146738","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5146738","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5146738\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=5146738"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}