-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allowing pushing custom events #60
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you! (And docs too ❤️). Please could you add a test proving that you can pass an arbitrary custom event as long as it appears in the file?
@@ -119,6 +119,12 @@ def self.blocklist | |||
Rails.application.config_for(:analytics_blocklist) | |||
end | |||
|
|||
def self.custom_events | |||
Rails.application.config_for(:analytics_custom_events) | |||
rescue RuntimeError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bad Rails not returning specific exception type in this context!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, right! I was actually considering checking first if the file exists and let it fail in case of syntax error. This would be probably a better option here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's painful, but I think I'd rather live with generic exception than break the abstraction of config_for
? wdyt?
@@ -177,6 +178,33 @@ DfE::Analytics.config.queue = :default | |||
|
|||
Alternatively you may consider setting the priority of the jobs according to your chosen ActiveJob adapter's conventions. | |||
|
|||
### 8. Custom events | |||
|
|||
If you wish to send custom analytics event, create a file `config/analytics_custom_events.yml` containing an array of your custom events types under a `shared` key like: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you wish to send custom analytics event, create a file `config/analytics_custom_events.yml` containing an array of your custom events types under a `shared` key like: | |
If you wish to send custom analytics events, create a file `config/analytics_custom_events.yml` containing an array of your custom event types under a `shared` key like: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fab, thanks @BroiSatse — pls merge once Rubocop happy!
@duncanjbrown can you merge this for us please? |
This small change allows all the users to define the custom events they would like to push to analytics database.