Closed jhubert closed 1 year ago
Hey @jhubert, thanks for the PR, but this should already be possible: https://github.com/ankane/ahoy/#track-additional-data
@ankane 🤦 I'm not sure how I missed that. I read through the docs and was surprised it wasn't supported. Thanks!
As we look at tracking events, our system needs to records more than just user and request details. We need to know the team the user is on and the company account that they're using.
This change allows you to specify those values in the controller like so:
The additional values need to map to attributes on the event and visit objects.
To implement this, I first looked at using the methods in the tracker.rb file. It felt like changing the data that was passed to track_visit or track_event would make sense. But, then I realized that you're adding user through the data store via the controller and decided that was a more reliable way to do it so I moved it there.
I couldn't figure out the best way to test this given that way that you have the tests setup, but I'm more than happy to put more effort in to add tests and get this ready to merge if you think it's worth adding.