Making the Woopra analytics code valid xHTML

Woopra is a ground-breaking web-analytics service that is seriously better than Google Analytics. However, the default javascript code is flawed, in the sense that it doesn’t validate as xHTML strict.

The default code looks like this :

<script type="text/javascript">
var woopra_id = 'XXXXXXXXXX';
</script>
<script src="http://static.woopra.com/js/woopra.js"></script>

where ‘XXXXXXXXXX’ is the website ID.

To make this valid xHTML, you just need to add type="text/javascript" to the second script tag; so that your code looks like this :

<script type="text/javascript">
var woopra_id = 'XXXXXXXXXX';
</script>
<script src="http://static.woopra.com/js/woopra.js" type="text/javascript"</script>

PS : Those of you who are using the Woopra WordPress plugin, you don’t need to worry about this. The plugin produces the valid xHTML code by default.

2 Comments

  1. Angel says:

    THANK YOU! THANK YOU! THANK YOU! I “googled” myself half blind looking for this solution! I owe ya1!! Kudos!

  2. Ellimist says:

    I’m glad this article helped you. :)