Skip to content

Conversation

woto
Copy link

@woto woto commented Feb 12, 2025

Hi, we need get access to the created event. What do you think if there

begin
event.save!

will be instead?

        begin
          event.save!
          event

or at least to assign last tracked event somewhere to avoid making request to the DB.

@ankane
Copy link
Owner

ankane commented Feb 12, 2025

Hi @woto, thanks for the PR. Can you share more about your use case?

@woto
Copy link
Author

woto commented Feb 13, 2025

@ankane Sure, we want to send info about ahoy event (at least id) to external tracking/metrics systems.

By the second option of getting access to the event, I meant something like this:

        tracker.track('event', {})
        ahoy_visit = tracker.visit
        ahoy_event = tracker.event

like it is done for the tracker.visit.

@woto
Copy link
Author

woto commented Mar 14, 2025

@ankane Hi, sorry for disturbing. So any thoughts about this?

@kevinrobayna
Copy link

You might want to do get inspired by this https://www.honeybadger.io/blog/ahoy-rails-analytics/

class Ahoy::Store < Ahoy::DatabaseStore
  def track_visit(data)
    Honeybadger.event("ahoy_visit", data)
    super(data)
  end

  def track_event(data)
    Honeybadger.event("ahoy_event", data)
    super(data)
  end

  def geocode(data)
    Honeybadger.event("ahoy_geocode", data)
    super(data)
  end

  def authenticate(data)
    Honeybadger.event("ahoy_authenticate", data)
    super(data)
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants