README.md in ahoy_email-0.1.2 vs README.md in ahoy_email-0.1.3
- old
+ new
@@ -140,9 +140,33 @@
```ruby
AhoyEmail.track open: false
```
+## Events
+
+Subscribe to open and click events. Create an initializer `config/initializers/ahoy_email.rb` with:
+
+```ruby
+class EmailSubscriber
+
+ def open(event)
+ # :message and :controller keys
+ ahoy = event[:controller].ahoy
+ ahoy.track "Email opened", message_id: event[:message].id
+ end
+
+ def click(event)
+ # same keys as above, plus :url
+ ahoy = event[:controller].ahoy
+ ahoy.track "Email clicked", message_id: event[:message].id, url: event[:url]
+ end
+
+end
+
+AhoyEmail.subscribers << EmailSubscriber.new
+```
+
## Reference
You can use a `Proc` for any option.
```ruby