Reputation: 18877
I have an ASP.NET MVC site and my google analytics code is the example code cut/pasted into my layout page. This is how it records root requests:
Can anyone tell me how to get it to record only the /
as the root url? For reference here is my analytics code:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("my code");
pageTracker._trackPageview();
} catch (err) { }
</script>
Upvotes: 1
Views: 894
Reputation: 43094
You need to set the _trackPageview
value to the page you want to log the metrics under, e.g.:
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("my code");
pageTracker._trackPageview("/");
} catch (err) { }
</script>
Upvotes: 1