Loading ...
Sorry, an error occurred while loading the content.

Google Analytics Filter - change subdomain to folder in reports

Expand Messages
  • ebeane
    Hello, anyone every written an advanced filter that take a subdomain and change it to a folder to keep reporting clean? For example: We want sub1.client.com to
    Message 1 of 4 , Jul 1, 2014
    • 0 Attachment

      Hello,


      anyone every written an advanced filter that take a subdomain and change it to a folder to keep reporting clean?


      For example:


      We want sub1.client.com to report it in GA as client.com/sub1 and of course be able to also capture all subfolder below it as well so if a user goes to sub1.client.com/folder/page.html it would report in GA as client.com/sub1/folder/page.html


      Any help is welcome ;)

    • dcivinelli
      I haven t done it before (disclaimer), but this filter might work: Extract A, hostname = sub1.client.com/.* output to: request URI = /sub1/$A1 Here s Google s
      Message 2 of 4 , Jul 1, 2014
      • 0 Attachment
        I haven't done it before (disclaimer), but this filter might work:

        Extract A, hostname = sub1.client.com/.*
        output to: request URI = /sub1/$A1

        Here's Google's support page for advanced filters such as this:
        Advanced filters - Analytics Help

         




      • naidusanjivini
        Hey Eric, You need to create 2 filters in order to have the desired output. Recommended to use a separate profile. This can be done using 2 steps Step1: Create
        Message 3 of 4 , Jul 2, 2014
        • 0 Attachment

          Hey Eric,

           

          You need to create 2 filters in order to have the desired output.

          Recommended to use a separate profile.

           

          This can be done using 2 steps

          Step1: Create advanced filter for displaying hostname as Request URI in all pages report

          Step2: Create filter to replace the hostname


          1)      By default GA would not provide the full URL in your pages report.

          For eg) “sub1.client.com/category” will be viewed as “/category” in All pages report

           

          You need to create a filter by Adding a hostname to a request URI* to view a full URL

          Go to Admin - Create a filter

          Once the above filter is applied; we will now be able to see the addition of hostname in all pages report.

          For eg) “sub1.client.com/category” will be viewed as “sub1.client.com/category” in All pages report

           

          The 2nd filter should be applied in order to replace the hostname with the desired output; as explained below:

          2) Create Search and Replace filter in GA under Admin


          Once the filter is applied in GA reporting under Pages report you would see the report in the below format:

          client.com/sub1/folder/page1.html

          client.com/sub1/folder/page2.html

          client.com/sub1/folder/page3.html

           

          Note:

          The change is applicable from the day you add the filter.

          *Replace string is either a regular string or it can refer to group patterns in the search expression using backslash-escaped single digits like (\0 to \9). If you want to have backslash('\') in the replacement string you must use double backslashes ('\\') instead.
          For more information you can also check https://support.google.com/analytics/answer/1034834?hl=en&ref_topic=1034830

          Does this answer your question?



          - Sanjivini

        • ebeane
          thanks for the replies, i used info from both of your posts and had some success but in the end it took a few more tweaks to make it work, for reference here s
          Message 4 of 4 , Jul 9, 2014
          • 0 Attachment
            thanks for the replies, i used info from both of your posts and had some success but in the end it took a few more tweaks to make it work, for reference here's what i did:

            3 total filters:

            • url rewrite : add hostname to uri (Advanced Filter)
              • the Standard add hostname filter used by most
            • url rewrite : move subdomain to folder (Search and Replace Filter)
              • To ensure this filter works on any profile, i used the filter below that would match on both dev and live servers
            Exclude
            Include
            Lowercase
            Uppercase
            Search and Replace
            Advanced
            Filter Field
            Search String
            Replace String
            Case SensitiveYes No

            • url rewrite : remove domain from url (Search and Replace Filter)
              •  

                Since we have historical data we do not want to all of sudden have our domain appear in reports where it didn't exists before so I created this filter to remove www.clientdomain.com or any other domain and subdomain and only report the path
            Filter TypePredefined filter Custom filter
            Exclude
            Include
            Lowercase
            Uppercase
            Search and Replace
            Advanced
            Filter Field
            Search String
            Replace String
            Case SensitiveYes No
            thanks everyone!


          Your message has been successfully submitted and would be delivered to recipients shortly.