ankane / ahoy_email

First-party email analytics for Rails
MIT License
1.11k stars 137 forks source link

[Feature Request] Using existing records in a custom message_model #120

Closed creativetags closed 5 years ago

creativetags commented 5 years ago

Tracking currently creates a new ahoy_message after an email is sent. I'm using my existing model where records are created before emails are sent as a sort of queue to be processed asynchronously by Sidekiq. I would like to be able to configure ahoy_email to lookup the existing record and update it with the tracking columns. Is this something that can already be done or would you be willing to add it? If not I'm just going to work around it but that seems like the optimal solution for my needs.

ankane commented 5 years ago

Hey @creativetags, you can use customized tracking to do this.

AhoyEmail.track_method = lambda do |data|
  # your code
end
creativetags commented 5 years ago

Great, I'll give that a go. Thanks!