I have an ASP.NET MVC (3) app and I\'ve set Google analytics up. The problem is that every time I run from Visual Studio the Google script starts gathering data, which of course
I would write a custom HTML helper which would include the necessary scripts for Google Analytics:
@Html.Analytics()
This helper could then use compilation directives and #if DEBUG
is set it would simply emit an empty string. And by the way there is already such helper available in the microsoft web helpers package and see how it is implemented:
@Analytics.GetGoogleHtml({your-analytics-webPropertyId-here})