I have an input button that calls a window.location.href event, and also want to add google analytics event tracking to the same button…
How would I combine these two events into one statement?
<input type="button" value="Learn More!" onclick="window.location.href='site1'" />
and this event:
onclick="_gaq.push(['_trackPageview', '/externalsite/site1']);"
You could use jQuery.
But a quick fix is to just combine them:
Statements are separated with a semi-colon.