Web Applications Stack Exchange is a question and answer site for power users of web applications. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to pass w3 xhtml strict validation and still use google analytic code on my webpage?

share|improve this question

closed as off topic by codingbadger Dec 2 '11 at 8:36

Questions on Web Applications Stack Exchange are expected to relate to web applications within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

What errors do you get when you insert google analytics on your page? – Justin Dearing Oct 14 '10 at 11:48
You will probably get better answers at webmasters.stackexchange.com. This site is about using existing web apps, not managing your own web site. – Al E. Oct 14 '10 at 15:17
up vote 0 down vote accepted

Yes, w3 xhtml strict validation does not check or see Javascript.

share|improve this answer
Presumably the <script> tags will need to be valid XHTML. – Al E. Oct 14 '10 at 15:15

The <script> tag in XHTML differs slightly from the one in HTML in that its content is of type (#PCDATA), which means that entities in the tag will be parsed. Thus most non-trivial code will break XHTML validation.

To make your <script> tag valid XHTML, use syntax like this:

<script type="text/javascript">//<![CDATA[
var i=10;
if (i<5) {
    // some code
share|improve this answer