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, skews the real results.
What's the best way to prevent Google Analytics from gathering data on the development environment other that using ugly #if
compiler directives on every page I want analysed?
What would be a best practice?
Thanks.
To disable Analytics programmatically, set the following window property to true : window['ga-disable-GA_MEASUREMENT_ID'] = true; Replace GA_MEASUREMENT_ID with the Analytics ID of the property that you would like to disable.
The integration with Google Play allows you to access your in-app purchase and subscription event data from Play in Google Analytics. You can use this information, for example, to define audiences or measure the performance of ad campaigns (if you have linked your ad accounts).
The best-practice advised by Google is to use a filter to remove the data from your GA profiles. This can either be done by filtering based on the IP address of development machines or by setting a custom variable cookie in each browser being used for development and testing. This approach would mean you could remove the data without needing to modify your main body of code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With