Skip to content
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

Merged
merged 3 commits into from
Jan 19, 2023

Conversation

BroiSatse
Copy link
Contributor

This small change allows all the users to define the custom events they would like to push to analytics database.

Copy link
Contributor

@duncanjbrown duncanjbrown left a 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
Copy link
Contributor

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!

Copy link
Contributor Author

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?

Copy link
Contributor

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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:

Copy link
Contributor

@duncanjbrown duncanjbrown left a 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!

@ddippolito
Copy link

@duncanjbrown can you merge this for us please?

@duncanjbrown duncanjbrown merged commit b916b44 into DFE-Digital:main Jan 19, 2023
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