I want to find a place to put my Google Analytics code in my ASP.NET web application. I would like to place it somewhere once and not have to copy and paste the code into multiple files. Is there somewhere that I could inject it that I would only have to include it once and all pages would be effected? I am not using MasterPages unfortunately.
Share
You would either need to have a base page, or put a custom control on each page where you need the script.
In either of those, you can subscribe to the Init event, and then do the following:
If you choose a base page, you can control which pages the script appears on by not inheriting from the base page. If you choose a control, you do the same by not putting the control on a page.