google-analyticssubdirectoryuser-tracking

Google Analytics - only track traffic to a folder of the 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?


Solution

  • 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)