Google analytics API - Tracking subdomains

送分小仙女□ 提交于 2019-12-05 18:50:36

setDomainName is only relevant for the cookies that Google Analytics uses for tracking sessions. That is, setting it as you are makes it such that all traffic across those subdomains will be tracked consistently.

However, that doesn't change the domain data that gets sent to Google Analytics. All hits are sent to Google Analytics with the hostname (document.domain in JavaScript) of the pageview. That value is accessible in the API under the dimension ga:hostname. You can either use it as a dimension for a query, or use it as a filter for data (ie, say "only return the data I'm querying for this specific filter.)

So, regardless of the setDomainName configuration, you'll be able to access and segment on a subdomain level basis using the Google Analytics API.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!