Google Analytics: urchinTracker is not defined
Por: alex | 3 Diciembre 2006 | Ver comentarios |
Muchos de los sitios que usan Google Analytics para manejar sus estadísticas, presentan un -pequeño- error en javascript cuando el visitante usa Firefox.


Para solucionar -realmente- este pequeño error, pueden usar una versión modificada del script de Google Analytics o cambiar lo siguiente para evitar que se muestre el error:
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "...."; urchinTracker(); </script>
por:
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "....";
if (typeof(urchinTracker) == 'function') {
urchinTracker();
}
</script>


Javier Pérez
4 de Diciembre de 2006, 01:38:58 pm
Hola Alex. El error lo da por culpa de la extensión AdBlock, que filtra http://www.google-analytics.com/urchin.js. Y por lo tanto, como no carga ese javascript, la función urchinTracker no queda definida cuando se llega a _uacct = “…”; urchinTracker();
Yo pondría un “if (urchinTracker) urchinTracker();”. Pero sólo por ser un poco quisquilloso
Saludos.
alex
4 de Diciembre de 2006, 01:43:42 pm
Ah, no me había dado cuenta de ese detalle, gracias por hacer notar mi error.
En cuanto a tu sugerencia, probé eso y seguía dando error, por eso puse el código un poco más largo
FooManChu
4 de Abril de 2007, 10:24:55 pm
Not only AdBlock, but also NoScript.
If the Firefox extension NoScript does not explicitly allow google-analytics.com, then again, urchinTracker will not be defined.
alex
5 de Abril de 2007, 09:02:52 am
Yeah, you’re right
Joe
15 de Abril de 2007, 06:38:05 am
Thank you so much, I have been looking for this fix for more than 6 months. I was having the problem in Internet Explorer. All fixed now. Gracias.
Aaron
19 de Mayo de 2008, 07:26:07 am
I have found that if you put the javascript code directly in the footer file instead of calling it from the footer file the script works without any modification.