How to Conditionally Load Google Analytics in a Web Application

Last Updated on Wednesday, 27 February 2013 08:44 Written by David Bauernschmidt Saturday, 2 March 2013 12:00

If you are a developer that uses Google Analytics in your ASP.net web applications then you know that loading up the Google Analytics in your web page should not happen when you are building the application. In the past I have always just commented out the section for Google Analytics until publishing the site. Then I would go in and uncomment the lines. This works if you do not forget to uncomment the lines in production. (This happened to me).

I decided that there had to be a better way to automatically do this. After searching the internet and pulling together prior knowledge of how an asp.net web site works I decided to use the web.config to help me. First add the following lines to your web.config production transformation file. (See here if you do not understand the transformation idea).

Learn More

Search

Authors

Web Hosting

Linux Hosting
ASP .NET Hosting
Business Hosting
Reseller Hosting
E-Commerce Hosting
Dedicated Servers

Acceptable Use Policy
Terms of Service
Privacy Policy

Affiliate Program
Site Map

Blog Hosting

PostNuke Hosting
WordPress Hosting
b2evolution Hosting
Textpattern Hosting
Habari Hosting


CMS Hosting

CMS Made Simple Hosting
phpNuke Hosting
Geeklog Hosting
phpWCMS Hosting
phpWebSite Hosting
Shopping Cart Hosting

OpenCart Hosting
osCommerce Hosting
CubeCart Hosting
Buy Safe Hosting
Zen Cart Hosting


Video Sharing Software Hosting

iVidPlay Hosting
ClipBucket Hosting
ClipShare Hosting
osTube Hosting
vShare Hosting
Forum Hosting

XMB eXtreme Hosting
phpBB Hosting
Simple Machines Hosting
Vanilla Forum Hosting
AEF Hosting


Social Network and Community Website Hosting

SocialEngine Hosting
Jcow Hosting
Skadate Hosting
Dolphin Hosting
Elgg Hosting
Copyright © 2003-2013 Arvixe, LLC. All trademarks are property of their legal owner.