Hi, I want to add an onclick event (from the patch in http://drupal.org/node/1923740 ) to my menu items with Google Analytics code, but this code is outputted wrong in the source code (so it's not working).

My code looks like this: _gaq.push(['_link', 'https://.......com']);

but is outputted like this: onclick="_gaq.push(['_link', 'https://.......com']);"

Is there a way to decode those entities in menu onclick event?
Thanks for your help


marameodesign’s picture


Did you find a solution for this?

Thank you

constantinejohny’s picture

not a real solution, but a workaround... I used a jQuery function to map events to my menu items like this:

<script type="text/javascript">
$(document).ready(function() {
   $("a.custom_class").bind('click', function() {
   _gaq.push(['_link', 'https://www.mysite.com']); return false;

You have to change the class of your menu item (a.custom_class),
and the code in the function (I needed to add _gag.push(), you can use whatever you want / need ).

Hope it helps :)