I am currently setting up Google Analytics for:
http://example.com (public website advertising the product)
https://example.com/app (the product, a single page application)
I am using two views to track them. The standard 'All website data' view to encompass the public website and all subfolders (including the single page application) and a separate view for the application itself which contains only application data. In the view for the application I use the filter 'Include only traffic to the subdirectories that begin with /app/' (case insensitive). And within the single page application I log page views like so:
ga('set', 'page', 'p=pageName');
ga('send', 'pageview');
However, I am seeing discrepancies in the 'All website data' view, where there are page loads clearly from within the application recorded as being from the root domain. There are entries for '/p=pageName' and '/app/p=pageName', in other words.
Why is this happening? Do I need to include /app/ in the ga('set') call? Is it related to my filters or that the app is 'https' while the root domain is 'http'? Any hints will be greatly appreciated.
For anyone who stumbles on this question: The answer was to prepend /app/ to the ga() calls, as proposed in my original question.
E.g.
ga('set', 'page', '/app/p=pageName');
ga('send', 'pageview');
Related
I have a website lets say http://www.example.com which is on shopware and uses google analytics to determine site traffic. I have designed a landing page which is placed at http://www.example.com/landing/index.html. Can I use the same tracking id that I have on other pages on my landing page? Will it appear under all website data section or will it create another automatically?
Actual website is not at example . com its just for reference purpose.
Yes, of course. The Google Analytics web tracker is client side code, it does not really care if your pages have been created by a shop system or by manually entering code somewhere. By the time it is displayed in the browser it's all just HTML.
The data will show up in "All Website data" (which is the only view GA ever creates automatically, everything else you need to set up yourself as needed).
I have a website (WordPress) that is set up at http://mydomain.com
I also have an app (meteor) that lives on a subdomain http://app.mydomain.com
I would like to track these two separately. I already have the tracking code on the WordPress site. Do I add the app as a new property or a new view?
When I tried to add the app as a separate property, in the tracking code I see this line:
ga('create', 'TRACKING_CODE', 'mydomain.com');
It seems to be that GA only cares about the top domain level?
Create one property for mydomain.com and two views: one for http://mydomain.com and one for http://app.mydomain.com. For the two views, create a filter that includes only traffic to that domain. E.g. Include Only Hostname (whatever).
Regarding this:
ga('create', 'TRACKING_CODE', 'mydomain.com');
Leave it as is. The mydomain.com allows you to track across subdomains, which is what you're trying to do.
suppose our company has website which was developed by asp.net web form v1.1. it is running for last 5 year. people search google by keyword and got the link to come to our site...it means google cached all the pages of our site. now our company planing to develop our site with asp.net 4.0 and our company CTO want to use asp.net 4.0 routing feature for search engine friendly. i am aware of how to use url routing feature....here is small sample snippet of url routing.
for our new website pages name will be change. so when some one will search google and get link and when click on those link then request will come to our site but page not found will show because page name will be changed. so how to write the logic in such a way as a result when old request will come then routing will redirect to right page and also do the permanent redirection for google as a result from the next time user will get right page url. so my concern is how to write the logic which will drive the user to right page if the old page does not exist, the user will be redirected to right page using routing. please help me with code & concept. thanks
You need to use a HTTP 301 Permanent Redirection
Using .NET Framework v4:
Response.RedirectPermanent("NewPage.aspx");
EDIT:
I jumped in too quickly there... a good MVC solution would be: http://www.eworldui.net/blog/post/2008/04/25/ASPNET-MVC-Legacy-Url-Routing.aspx
This will redirect the request to the right place and return a 301 back...
If you do it via MVC, you will always have to manage those old routes. I think the best way is tu use directly IIS for this scenario. The url module in IIS allows you to configure permanent redirects very easily.
I am not an expert of MVC, infact a starter, so the solution that comes in my mind is you will have to register all routes for your existing pages like:
routes.MapRoute(
"BooksCategory", // Route name
"products/books.aspx", // URL with parameters
new { controller = "Products", action = "Browse", category = "Books" }
);
You can enhance it according to your needs.
I's suggest using a hybrid of this tools. You should return 301 as it's a permanent move. Google should pick-up on that when it starts scanning your new site.
I'd suggest you also need to keep your legacy urls separate, so they don't interfere with the current site. At some point in the future, perhaps when this new site becomes the legacy site, you'll want to organise your urls. By knowing what's needed by the app & what's for SEO might help.
You can probably do your SEO redirection using IIS and it's redirection module. Also, have look at Googles (and Bings) webmaster tools. They should help you figure our what the search engine is seeing on your site.
I want to track traffic for mysite.com/current-campaign/ and careless about traffic on mysite.com in general.
Is it ok to place the GA tracking code in the files inside the /current-campaign/ folder or does it HAVE TO be in the root of the server for tracking to work?
GA will only track on the pages you actually put the tracking code on, regardless of where the page is located (unless you start messing with things like domain settings or filters etc..).
So IOW yes, it is okay to do that. If you don't have tracking code on mysite.com/somePage.html then it's not gonna track that page (though it might show up as the URL in some reports like referring URL or exit link or whatever, same as any other page you don't track)
In Google Analytics, you can add a filter to the profile and filter all but the chosen directories. Go to Analytics Settings > Profile Settings and look for "Add Filter" link.
In addition to Crayon's answer, you can limit tracking to a subdirectory by using _setCookiePath() function in your tracking function. See Analytics documentation on single subdirectory (note the link anchor is not resolved to a correct header, at least for me).
This is advised in the documentation to use when you only want to track a subdirectory and avoid clashes with Analytics trackers possibly in use in other subdirectories.
I work for a department in a large university.
The department's web page resides at www.some-uni.com/department-name/.
I only have FTP access to the sub-folder /department-name/ and nothing else on the site.
It was quite easy to get Google Analytics to track traffic within the subfolder /department-name/, ignoring the rest of the site. All I did was create a profile in GA, setting the default url to www.some-uni.com/department-name/. I then pasted the tracking code into the pages I wished to track.
It took about eight hours for anything to show up in GA, but after that it worked just fine.
For some reason Google Analytics is appending index.cfm to the end of all of my URLs when I look at them in GA. The domain used to be ColdFusion based, but is now a WordPress PHP website running on an Apache server without ColdFusion installed.
We've added new pages to the website, and GA is still reporting an index.cfm at the end of the URL, even though that page never existed on the old ColdFusion site.
I didn't set up the GA account initially, is there maybe a setting that was enabled? Or does it take GA a while to figure out it's not a ColdFusion website anymore?
By the way, the website in question is http://www.westgatereservations.com. Thanks.
--ADDED--
Screenshot of page list from Google Analytics. All of these pages are WordPress PHP pages that use a clean permalink URL structure.
This is Google Analytics's 'Default Page' feature. If you go to the Account Settings and Edit the Profile Information, you'll see there's a field called "Default Page". It basically does what the theoretical filter I described above does: it automatically appends the default page (in this case, index.cfm) onto every page URL that doesn't have a page suffix. It's a shortcut, since most of the time, users want /foo and /foo/index.html to be counted as the same thing. But it totally breaks on WordPress and 'prettified' URLs, since they don't have a file suffix.
Just remove the Default Page (leave it blank) and the problem should be resolved. I'm not sure if it will be retroactive (Google Analytics rarely allows retroactive changes), but it will resolve the problem moving forward.
Read more about Google Analytics Default Page