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 :)

joelpittet’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

Considering this module will add the event to breadcrumbs menu items and in the admin menu links as well. I think your workaround may be a better solution to target the actual menu items you are looking to target on the front end.

Another solution is to use google's new GTM or Google Tag Manager. That way marketing folk can add these little snippets to their hearts content.