Trackpad cursor moving around on its own and clicking anywhere
To answer your question, the part you linked should work with your MacBook Pro. Before purchasing a new trackpad, I would suggest you try a few troubleshooting steps.


Reset the SMC


Resetting the SMC can resolve some problems on a Mac, particularly hardware issues.

Possibly using an external mouse, shut down your Mac.  Then hold the shift, control and option keys along with the power button. After holding these keys for 10 seconds, let go of them and power on your Mac normally. If this does not help, try using Safe Boot.

You can find out more about resetting the SMC here: How to reset the System Management Controller (SMC) on your Mac


Safe Boot


In this case, you wouldn't want to stay booted into Safe Mode, but you can still benefit from what Safe Mode does to narrow down the source of the issue. According to Apple, Safe Boot does the following things:


  
  Verifies your startup disk and attempts to repair directory issues,    if needed
  Loads only required kernel extensions
  Prevents startup items and login items from opening automatically
  Disables user-installed fonts
  Deletes font caches, kernel cache, and other system cache files
  


To boot into Safe Mode, first shut down your Mac. Then press the power button to power on your device while holding the left shift key on the internal keyboard. Once you see either the login window or your desktop, you can reboot the Mac normally

Just verifying the startup disk and clearing caches can be helpful. I had a very similar case, even with a similar model Mac, where this resolved the issue. If the issue only occurs outside of Safe Mode, then that is also helpful to know.

If that doesn't work

If neither of these things resolve the issue, then I would suggest you take your Mac to an Apple store for a repair estimate. If you would rather perform the repair yourself, the linked part should be compatible with your Mac.