Validate "Custom JavaScript Code" not having <script> tags added
prof_stoopid - March 9, 2008 - 13:16
| Project: | Google Analytics |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
When validating any of my sites's pages (http://ulf.kister.org/) by http://validator.w3.org/check?uri=referer the W3C validation service reports errors caused by the script tags inside the page's body.
Solution would probably be placing the script code inside the page header...

#1
Next version allows switching to header, but this is not supported by google and us, too.
Your footer codes gets invalid, while you made it invalid yourself.
#2
Obsoleted by #1
Placing the script in the page's footer is probably smart by means of
- minimizing rendering delay
- registering only "real" page views where the user's browser has reliably at least loaded and rendered he whole page
therefore an optional placement inside the header and some explanatory words about the pros and cons of this option would do the trick even better...
#3
> while you made it invalid yourself.
What do you mean? How to avoid??
#4
#5
You placed script tags inside script tags, this makes the code invalid. Have you used "JavaScript Code" to add you own code? Read the docs below this text area...
#6
Stoopid me (my nick seems to be my manifesto :-). This solved the XHMTL 1.0 issue.
Thank you so much for the quick analysis and fix!
#7
I'm moving this into a feature request.
We should validate if contend added into "JavaScript Code" section contains script tags.
#8
This would at least make it a little more fool proof for users like me ;-)
Thanks again for the incredibly quick answers and assistence!
#9
Only for me... why are you adding ga.js twice? You should really REMOVE all your code added into the "JavaScript Code" text area.
#10
DE: Sach mal... was machst Du da eigentlich? :-) Du musst in das JavaScript Feld *nichts* eingeben damit das Modul einwandfrei arbeitet! Man braucht dieses Textfeld nur für sehr wenige Spezialfälle... aktuell trackst Du jede Seite 2 mal.
#11
> why are you adding ga.js twice?
By mistake, i must admit. Fixed nox.
Thank you again!
#12
The script tags should be escaped and that will allow them to validate.
<script type="text/javascript">
//<![CDATA[
JAVASCRIPT CODE HERE
//]]>
</script>
This is considered proper form and the safest way to include JavaScript in an (x)HTML document.
#13
@reli4nt: no, the code inserted into the text area should not have any script tags at all. We need a regex testing for
<script>$on the end and the same one the beginning or better - there should be no script tag at all. I can think about some edge cases where this might limit somebody, but it's the only save way.#14
#15
Solved in D5 and D6.
#16
Automatically closed -- issue fixed for two weeks with no activity.