mixpanel track links sends me to another page

  • 28 January 2021
  • 1 reply

  • Frequent Contributor
  • 5 replies

Im having an issue with my page, I’ve set up my tracking this way:

mixpanel.track_links('#heroButton', 'Clicked Nav Link');


When I click the link it seems to act weird and it takes me to an undefined page, on my wordpress website.

in my console im getting this:

Any ideas on what I can do to stop that?


1 reply

Userlevel 2
Badge +2

Hey Daryl,

Could you try applying a specific id to the link itself and then referencing that id in the track_links call? Please see the example below that I used for testing.

<p><a id="mixpanelLink" href="">Go to Mixpanel!</a></p>
 mixpanel.track_links("#mixpanelLink", "Clicked WordPress Mixpanel link")


In your case, it’d be flipping mixpanelLink with heroButton