AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
5.4K members online now
5.4K members online now
Ask questions about filter set-up and issues with using filters in Google Analytics reports
 
Guide Me
star_border
Reply

How to set up code for a a sub-page

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi - I have a main domain but what I want to do is set up sub-domain page like:

 

mysite.com/stories

 

And then I want to set up or generate new GA code that I put on the pages inside of that "stories" sub-domain.  I've never set up something new like this is GA so can someone explain to me how to do this?

 

Thank you.

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Michael W
April 2016

Re: How to set up code for a a sub-page

[ Edited ]
Explorer ✭ ✭ ☆
# 8
Explorer ✭ ✭ ☆

1. Go to property setting of your existing property for your homepage > Tracking info > Tracking code
2. Copy the GA tracking code from the page and then paste it immediately after the opening </head> tag in the page source code of all subdirectory pages of your website.
3. Create views for your subdirectories in the exisiting GA property
4. Go to filters in the view settings and then create filters to include your subdirectroies using - Predefined > Select filter type = include only > Select source / destination = traffic to subdirectroies .

The video and the link below should help you understand and create filters.
https://www.youtube.com/watch?v=X_aWfcfSONA
https://support.google.com/analytics/answer/1033162#PredefinedFilters


View solution in original post

Re: How to set up code for a a sub-page

Explorer ✭ ✭ ☆
# 2
Explorer ✭ ✭ ☆
I'm assuming you don't have GA account, so here are the steps -
1. Sign up for Google analytics
2. Create a new account in GA.
3. Go to property setting > Tracking info > Tracking code
4. Copy the GA tracking code from the page and then paste it immediately after the opening </head> tag in the page source code of all pages of your website.

Re: How to set up code for a a sub-page

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi - I actually do have an account and I know how to paste the code into my pages. I don't want to paste that same code though as I want different code to track the sub-domain. Can you tell me how to do that? Thank you.

Re: How to set up code for a a sub-page

Top Contributor
# 4
Top Contributor
Hi Michael,

/stories is a sub directory, not a sub domain. Sub domain would look like stories.mysite.com.
If you want to track your subdirectory separately, you can use the same tracking code and set up a new view and apply a filter to include traffic only to the subdirectory. Or you can set up a new property and use the tracking code for that property on the pages in the subdirectory if you want to track the subdirectory as a different property. Let me know if you have questions.

Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

Re: How to set up code for a a sub-page

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Hi - thanks for the reply. Are there any step by step instructions on how to do this? I'm really not familiar with how to do it. Thanks.

Re: How to set up code for a a sub-page

Explorer ✭ ✭ ☆
# 6
Explorer ✭ ✭ ☆
Hi Michael,

It depends on how you would like to track.

1. If you would like to track on the same GA property for your homepage and use filtered view to view the subdirectory pages, then you just need to insert the same GA code from the homepage to your subdirectory pages immediately after the opening </head> tag.

2. If you would like to track the subdirectories as separate properties, then you need to create new properties for each subdirectories and then generate GA code and insert the relevant GA code on the subdirectory pages.

Since the subdirectories are on the same domain, it makes more sense to track them in a single GA property using the option 1 above.

Re: How to set up code for a a sub-page

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
OK great let's do the option 1 - any step by step or a link would be perfect for me. Also, it's been a while since I even got the original GA code from my account but can you tell me where I can get that code again within GA? Thanks for your patience with me.
Marked as Best Answer.
Solution
Accepted by topic author Michael W
April 2016

Re: How to set up code for a a sub-page

[ Edited ]
Explorer ✭ ✭ ☆
# 8
Explorer ✭ ✭ ☆

1. Go to property setting of your existing property for your homepage > Tracking info > Tracking code
2. Copy the GA tracking code from the page and then paste it immediately after the opening </head> tag in the page source code of all subdirectory pages of your website.
3. Create views for your subdirectories in the exisiting GA property
4. Go to filters in the view settings and then create filters to include your subdirectroies using - Predefined > Select filter type = include only > Select source / destination = traffic to subdirectroies .

The video and the link below should help you understand and create filters.
https://www.youtube.com/watch?v=X_aWfcfSONA
https://support.google.com/analytics/answer/1033162#PredefinedFilters


Re: How to set up code for a a sub-page

Visitor ✭ ✭ ✭
# 9
Visitor ✭ ✭ ✭
Thanks so much!