Keep in mind that profile scripts run on the Target server-side. So they have no visibility to client-side events (things that happen in the browser) unless the browser makes a call to Target with some data about the event.
So if you want to run a profile script on a click event you have to add a getOffer() or trackEvent() function to the onclick. In the trackEvent you can pass any necessary info in as parameters of the request. Then in the profile script I would add logic that only runs the script when the specific request I'm looking for (click event) is seen. Take any of the applicable data and read/store/parse it as needed.