mixcloud/django-experiments — pull request #100 by fmoga (2013-01-23 13:58:37+00:00)
Title: Closest experiment goal

Use jquery `closest()` to determine whether the clicked element triggers experiment goal.

After introducing the addEventListener mechanism to set goals via cookie in the capturing phase of event handling in pull request https://github.com/mixcloud/django-experiments/pull/87, elements above the clicked element that have a `data-experiments-goal` attribute aren't reported as goals anymore, like in the bubbling event handling flow.

This pull request uses jquery `closest()` to simulate this behavior and determine whether the current event target triggers an experiment goal on parent elements. If it does, it sets the cookie correspondingly.

Also, POSTing to the goal endpoint fails if the URL doesn't have the trailing slash.