Events vs. Custom Variables - Use Cases

I’ve noticed people using an onclick handler for links with both trackEvent and setCustomVariable on links.

What I’m trying to determine is the use cases for each.

Assuming I want to understand how users interact with my product on a fairly finite level (tracking clicks and form submissions), when should I use trackEvent and when should I use setCustomVariable?

Also, from what I gathered in the docs, there are only 5 custom variables I can use per page or visit. Does this mean the value (1-5) cannot be a duplicate?

How are people using setCustomVariable in Piwik?

Thank you.

Basically you use events when you want to track actions that don’t require page refresh or are redirecting to external sites. For any other normal actions you can use custom variables. It’s up to you what keys and values do you set for each visit/page view. You can also increase the amount of custom variables.