Closed GoogleCodeExporter closed 9 years ago
Please ask future async questions in the async forum:
http://www.google.com/support/forum/p/Google+Analytics/label?
lid=5a6c689030bdafe7&hl=en
you should already be able to do this via the syntax:
_gaq.push(
["_setAccount", "UA-1234-5"],
["_trackPageview"]);
Original comment by nickski1...@gmail.com
on 11 Mar 2010 at 12:30
I guess my use case is in a server-side templating environment:
<%
commands = [ ["_setAccount", "UA-1234-5"], ["_trackPageview"] ]
%>
<script type="text/javascript">
_gaq.push(<% json_stringify(commands) %>);
</script>
Original comment by daep...@gmail.com
on 11 Mar 2010 at 12:46
^^ with the existing syntax you would have to do this:
<%
commands = [ ["_setAccount", "UA-1234-5"], ["_trackPageview"] ]
%>
<script type="text/javascript">
var my_gaq = <% json_stringify(commands) %>
for (var i=0,l=my_gaq.length; i<l; i++) {
_gaq.push(my_gaq[i]);
}
</script>
Original comment by daep...@gmail.com
on 11 Mar 2010 at 12:49
_gaq.push(
["_setAccount", "UA-1234-5"],
["_trackPageview"]
);
is NOT the same as:
_gaq.push( [
["_setAccount", "UA-1234-5"],
["_trackPageview"]
] );
unless you are eluding to:
_gaq.push.apply(_gaq, [
["_setAccount", "UA-1234-5"],
["_trackPageview"]
] );
???
Original comment by daep...@gmail.com
on 11 Mar 2010 at 12:59
yup. you can use apply to pass in an array of parameters.
Original comment by n...@google.com
on 11 Mar 2010 at 1:13
blech! but I guess that will have to do.
Original comment by daep...@gmail.com
on 11 Mar 2010 at 1:26
Removing an obsolete label that was used when these issues were in the
gdata-issues project.
Original comment by jrobbins@google.com
on 21 Jul 2011 at 10:05
Changing the issue type to match the organization desired in this project.
Original comment by jrobbins@google.com
on 21 Jul 2011 at 10:06
Original issue reported on code.google.com by
daep...@gmail.com
on 10 Mar 2010 at 7:37