我的代码如下所示:
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<ul class="nav pull-right">
<% if user_signed_in? %>
<li class="dropdown" id="menu7">
<a class="dropdown-toggle" id="username" data-toggle="dropdown" href="#">
<%= current_user.full_name %>
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><%= link_to('Edit my account', edit_user_registration_path,
:id => 'edit_account') %></li>
<li><%= link_to('Logout', destroy_user_session_path, :method => 'delete',
:id => 'logout_link') %></li>
</ul>
</li>
<% else %>
<li><%= link_to('Login', new_user_session_path, :id => 'login_link') %></li>
<li><%= link_to('Sign up', new_user_registration_path, :id => 'signup_link') %></li>
<% end %>
</ul>
</div>
</div>
我的javascript事件是这些:
mixpanel.track_links('#username', 'Username clicked')
mixpanel.track_links('#edit_account', 'Edit account link clicked')
mixpanel.track_links('#logout_link', 'Logout link clicked')
我不知道为什么(我真的看起来很奇怪!)只有“点击用户名”事件有效。有没有人经历过类似的事情?