Unexpected dangling '_' in '_gaq'

Viewed 9848

I'm trying to validate my Google Analytics code using JSLint but I get a lot of error messages:

The code:

/*global document */
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-24389816-1']);
_gaq.push(['_trackPageview']);

(function () {
    var s,
        ga = document.createElement('script');
    ga.type = 'text/javascript';
    ga.async = true;
    ga.src = ('https:' === document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(ga, s);
}());

Error messages:

Problem at line 2 character 5: Unexpected dangling '_' in '_gaq'.

var _gaq = _gaq || [];

Problem at line 2 character 12: Unexpected dangling '_' in '_gaq'.

var _gaq = _gaq || [];

Problem at line 3 character 1: Unexpected dangling '_' in '_gaq'.

_gaq.push(['_setAccount', 'UA-24389816-1']);

Problem at line 4 character 1: Unexpected dangling '_' in '_gaq'.

_gaq.push(['_trackPageview']);

What's wrong? Thank you.

2 Answers
Related