I am wrapping up an MSM build that has one domain and three subdomains. Each site has unique Analytics code.

Conditional code based on segment is very useful but I am not sure how to display conditional code based on domain name. It would be handy to use a segment_0, but that obviously does not work.

Is there some other conditional code that would enable display of the analytics code based on the domain name?

1 Answer 1


You can use a conditional with {site_id} or {site_short_name}.

If you still want to set the condition based upon on the domain, you can use {site_url}.

  • Thank you. This is exactly what I needed. It works perfectly.
    – forrest
    Feb 7, 2017 at 16:58

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.