Skip to content

Commit

Permalink
Update custom events documentation example
Browse files Browse the repository at this point in the history
The interface for the `DfE::Analytics#with_data` method has changed.

It requires to have a `data` key on the top level containing the data
hash.

If not provided, the data hash gets ignored when creating the event.
  • Loading branch information
scruti committed Dec 6, 2024
1 parent 0f5cb40 commit 7392b11
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ If you wish to send custom analytics event, for example if you have data about e
```yaml
shared:
- some_custom_event
- another_custom_event
- another_custom_event
```

Then in the code create your custom event and attach all the information you want to pass:
Expand All @@ -311,7 +311,7 @@ event = DfE::Analytics::Event.new
.with_user(current_user)
.with_request_details(request)
.with_namespace('some_namespace')
.with_data(some: 'custom details about event')
.with_data(data: { some: 'custom details about event' })
```

If you need to include hidden PII, you can use the `hidden_data` key which will allow all fields listed to be sent separately to BigQuery where they will be hidden.
Expand All @@ -323,11 +323,11 @@ event = DfE::Analytics::Event.new
.with_request_details(request)
.with_namespace('some_namespace')
.with_data(
data:
{
data:
{
some: 'custom details about event'
},
hidden_data: {
hidden_data: {
some_hidden: 'some data to be hidden',
more_hidden: 'more data to be hidden,
}
Expand Down Expand Up @@ -391,7 +391,7 @@ it "sends a DFE Analytics web request event" do
end.to have_sent_analytics_event_types(:web_request)
end
# have_been_enqueued_as_analytics_events expects that as part of the spec, event types
# have_been_enqueued_as_analytics_events expects that as part of the spec, event types
# have been sent
it "sends DFE Analytics request and entity events" do
perform_user_sign
Expand Down

0 comments on commit 7392b11

Please sign in to comment.