Google Analytics Plugin: Modify for Subdomains

I would like to make the Google Analytics plugin work across my entire MU/BuddyPress install (easy), the difficult part is implementing these instructions:

Since I only add the tracking code (Ex: UA-XXXXX-2) in the options page, then how do I add this line:



  • James Farmer

    You should have the option tio enter a tracking code in Site Admin > Options and also allow your users to enter their own codes in Settings > Analytics.

    In terms of customising it to show the subdomains though I'm not entirely sure :disappointed: I guess you'd have to make an edit to the core code.

    Although we could probably do with releasing a version that did this for you too! I'd certainly like it on Edublogs :slight_smile:

    Anyone else put this into action with this plugin?

  • Aaron

    I skip that line with no problems. Adding that would also mess up tracking for mapped domains too.

    Just do this in Analytics (it's what I use):

    If you'd like to distinguish between your subdomains, you can create an Advanced filter for your profile with the following settings:

    Filter Type: Custom filter > Advanced
    Field A: Hostname
    Extract A: (.*)
    Field B: Request URI
    Extract B: (.*)
    Output To: Request URI
    Constructor: /$A1$B1

    With this filter in place, the previous examples would appear with the subdomain attached:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.