title: How can I add onclick events to Wordpress Menus
body: <p>I'm trying to add an <code>onclick</code> event to a WordPress menu that uses a nav walker. While I understand code and php I'm not very experienced with the WordPress system nor would I could myself an experienced coder.</p>
  
  <p>I have a menu item that I'd like to add an <code>onclick</code> event to it but I can't figure how to do this.</p>
  
  <p>Normally I'd use code such as the following</p>
  
  <pre><code>&lt;a href="tel:1300XXXXXX" onclick="__gaTracker('send','event','phone call','click');"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>The menu itself looks like this</p>
  
  <pre><code>&lt;nav&gt;
      &lt;ul class="sf-menu"&gt;
          &lt;li id="menu-item-2785" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-2785"&gt;&lt;a href="tel:1300XXXXXX"&gt;&lt;span class='icon-phone'&gt;&lt;/span&gt;Call us today 1300 XXX XXX&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/nav&gt;
  </code></pre>
  
  <p>While I can specific the link in the menu to be a <code>tel:</code> link there is no way from what I see to add an <code>onclick</code> to menu item itself.</p>
  
  <p>I tried a plugin called the <a href="https://WordPress.org/plugins/jin-menu/" rel="nofollow noreferrer">Jin Menus</a> but for the life of me I couldn't it to work.</p>
  
  <p>I also found these articles but haven't been smart enough to get them to work at this point</p>
  
  <p><a href="https://stackoverflow.com/questions/15494840/how-to-add-an-onclick-function-to-WordPress-menu-item-for-google-cross-domain-t">How to add an onclick function to wordpress menu item (For google cross domain tracking)</a></p>
  
  <p>I would greatly appreciate any help you could provide.</p>