Skip to content

Commit

Permalink
fix(analytics)!: add missing reserved event names (#5630)
Browse files Browse the repository at this point in the history
Updated list taken from https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Event

BREAKING CHANGE: some reserved words that were accepted before will throw exceptions now that the list is complete - do not use reserved words for analytics events
  • Loading branch information
liamjones authored Oct 31, 2021
1 parent 25e1d3d commit 2c1958e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
23 changes: 13 additions & 10 deletions docs/analytics/usage/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,19 @@ The Analytics package works out of the box, however a number of events are autom
These event names are called as 'Reserved Events'. Attempting to send any custom event using the `logEvent` method
with any of the following event names will throw an error.

| Reserved Events Names | | |
| ---------------------- | ------------------------- | ------------------- |
| `app_clear_data` | `app_uninstall` | `app_update` |
| `error` | `first_open` | `first_visit` |
| `first_open_time` | `first_visit_time` | `in_app_purchase` |
| `notification_dismiss` | `notification_foreground` | `notification_open` |
| `notification_receive` | `os_update` | `session_start` |
| `screen_view` | `user_engagement` | `ad_impression` |
| `ad_click` | `ad_query` | `ad_exposure` |
| `adunit_exposure` | `ad_activeiew` |
| Reserved Events Names | | |
| -------------------------------- | ------------------------------ | ------------------------------- |
| `ad_activeview` | `ad_click` | `ad_exposure` |
| `ad_impression` | `ad_query` | `ad_reward` |
| `adunit_exposure` | `app_background` | `app_clear_data` |
| `app_remove` | `app_store_refund` | `app_store_subscription_cancel` |
| `app_store_subscription_convert` | `app_store_subscription_renew` | `app_update` |
| `app_upgrade` | `dynamic_link_app_open` | `dynamic_link_app_update` |
| `dynamic_link_first_open` | `error` | `first_open` |
| `first_visit` | `in_app_purchase` | `notification_dismiss` |
| `notification_foreground` | `notification_open` | `notification_receive` |
| `os_update` | `session_start` | `session_start_with_rollout` |
| `user_engagement` |

## App instance id

Expand Down
7 changes: 7 additions & 0 deletions packages/analytics/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ import version from './version';
import * as structs from './structs';

const ReservedEventNames = [
'ad_activeview',
'ad_click',
'ad_exposure',
'ad_impression',
'ad_query',
'ad_reward',
'adunit_exposure',
'app_background',
'app_clear_data',
// 'app_exception',
Expand All @@ -53,6 +59,7 @@ const ReservedEventNames = [
'dynamic_link_first_open',
'error',
'first_open',
'first_visit',
'in_app_purchase',
'notification_dismiss',
'notification_foreground',
Expand Down

1 comment on commit 2c1958e

@vercel
Copy link

@vercel vercel bot commented on 2c1958e Oct 31, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.