Skip to content

Commit

Permalink
fix(analytics): allow custom event parameters for screen_view events
Browse files Browse the repository at this point in the history
  • Loading branch information
tomonacci committed Oct 25, 2021
1 parent 89b104a commit bc42412
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/analytics/__tests__/analytics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ describe('Analytics', function () {
'firebase.analytics().logScreenView(*):',
);
});
it('accepts custom event parameters', function () {
expect(() => firebase.analytics().logScreenView({ foo: 'bar' })).not.toThrow();
});
});

describe('logAddPaymentInfo()', function () {
Expand Down
4 changes: 4 additions & 0 deletions packages/analytics/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,10 @@ export namespace FirebaseAnalyticsTypes {
* Current class associated with the view the user is currently viewing.
*/
screen_class?: string;
/**
* Custom event parameters.
*/
[key: string]: any;
}

export interface RefundEventParameters {
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics/lib/structs.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const Item = struct({
price: 'number?',
});

export const ScreenView = struct({
export const ScreenView = struct.interface({
screen_class: 'string?',
screen_name: 'string?',
});
Expand Down

0 comments on commit bc42412

Please sign in to comment.