asp.netjavascriptgoogle-website-optimizermaster-pages

Adding a ContentPlaceHolder to site.master


Apologies for the terribly newb question. We're currently implementing Google Web Optimizer in our ASP.NET Web Application and some of the code is supposed to go in very specific places on certain pages. For example, for the "Control Page" Google has some Javascript that sits outside of the <html> tags.

I know I probably don't need to place the code exactly where Google recommends, but we've been getting some goofy results lately, and I really wanted to make it as watertight as possible to ensure it's not just bad implementation.

We have a lot of files in our project that reference the site.master, but only one needs to have some Javascript placed outside the <html> tag.

This, in theory, seems simple enough, my question is this: Do I need to put a ContentPlaceHolder in every file that references the site.master? (Even the tens that aren't passing any code to the site.master?) That's not something I feel like doing for many different reasons (altering tens of files). If that's the case, and I do need to add empty ContectPlaceHolders to every page, is there some other way around things without having to piece together a unique file just to put some Javascript outside of the <html> tag?

Thanks for any help.


Solution

  • The answer is no, as long as the ContentPlaceHolder in the Master is empty. That way, you only put Content for that ContentPlaceHolder on the pages where you want something rendered.