ahoy.js
ahoy.js copied to clipboard
Allow override eventProperties
For my particular case I need to pull off the element more properties than pulled by default (id, className, section). To be more precise, I want to pull whole dataset.
The most straightforward way to do so is overriding eventProperties, which is used in trackClicks, trackSubmits and trackChanges.
However in its current state I can override trackClick and others, but that would be too much of a monkey patch.
I believe making eventProperties overridable won't hurt anyone and will improve the options to customize events data.
@ankane ?
Hey @dmitriy-kiriyenko, thanks for the PR, and sorry for the delay (have been focused on other projects). This makes sense to me. Let's add it as a config option instead of a separate method.
ahoy.configure({
eventProperties: function(e) { ... }
})
@ankane if I finish this one off, would you be willing to merge this in?