ankane / ahoy

Simple, powerful, first-party analytics for Rails
MIT License
4.23k stars 377 forks source link

[Idea] Allow custom attributes server side #560

Closed pedrocarmona closed 2 months ago

pedrocarmona commented 2 months ago

Hi @ankane,

Would be nice if Ahoy::EventsController would allow to customize extra data.

Scenario: A controller that inherits fromAhoy::EventsController, could add extra data to the event based on subdomain, etc.

Proposal: Refactor the method create and split the method into smaller methods, so that it would be possible to inherit and call ahoy.track with extra params.

A workaround is possible by customizing the Ahoy::Store, and performing if statements to check subdomain.

ankane commented 2 months ago

Hi @pedrocarmona, thanks for the suggestion. You can achieve this by customizing track_event (similar to this).