Track Goals across subdomains in Google Analytics

2020-04-21 04:45发布

问题:

We have two platforms, a marketing site and a SaaS solution.

The marketingsite is on the main domain like www.domain.com and the SaaS solutions is on our subdomain sub.domain.com.

I would like to track the conversion rate of the customers signing up on our SaaS solution through our marketingsite.

If I go into goals for the marketingsite I can choose a relative path to the goal like www.domain.com/signup-completed, but the actual signup is on sub.domain.com/signup-completed. How can I track this on the marketing site?

The two sites are setup as different properties under the same account.

回答1:

First of all, the property must be same for both subdomain and domain, i.e. same UA id.

Secondly, to track goals from sub domain, you need to include every part of the URL in the Page dimension. Normally you will not be able to distinguish which page is on which domain

For the above you need to create a filter that would modify the URL to include domain:

Steps:

  • In the View (Profile) Settings page, click the Add Filter link.
  • Choose Add New Filter and provide the filter a name.
  • Choose Custom Filter and select Advanced on the Filter type settings.

Under Advanced settings:

  • FieldA should be set to Hostname
  • FieldB should be set to Request URI
  • Set the values for both Field A and Field B to (.*), which is an expression that captures all characters.
  • Set the Output To --> Constructor option to Request URI and provide $A1$B1 as the value for that choice.

Your reports will now show:

  • www.domain.com/example.html
  • sub.domain.com/moreexample.html

This will capture the www.domain.com portion of your URL and include that at the beginning of your page URL in the content reports section.

You can then easily set the goals :)


PS: I would recommend to create new view, place this filter and then create goals, so that the data in other views wont be affected