ahoy.js icon indicating copy to clipboard operation
ahoy.js copied to clipboard

Allow override eventProperties

Open dmitriy-kiriyenko opened this issue 5 years ago • 3 comments

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.

dmitriy-kiriyenko avatar Jul 08 '20 05:07 dmitriy-kiriyenko

@ankane ?

dmitriy-kiriyenko avatar Jul 21 '20 05:07 dmitriy-kiriyenko

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 avatar Oct 06 '20 22:10 ankane

@ankane if I finish this one off, would you be willing to merge this in?

imcodingideas avatar Jun 25 '21 16:06 imcodingideas