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

feat(analytics): allow custom event parameters for Item in events #7908

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/analytics/__tests__/analytics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,12 @@ describe('Analytics', function () {
}),
).toThrowError('firebase.analytics().logAddToWishlist(*):');
});

it('items accept arbitrary custom event parameters', function () {
expect(() =>
firebase.analytics().logAddToWishlist({ items: [{ foo: 'bar' }] }),
).not.toThrow();
});
});

describe('logBeginCheckout()', function () {
Expand Down
5 changes: 5 additions & 0 deletions packages/analytics/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ export namespace FirebaseAnalyticsTypes {
* The promotion name associated with the item.
*/
promotion_name?: string;
/**
* Custom event parameters. The parameter names can be up to 40 characters long and must start with an alphabetic character and contain only alphanumeric characters and underscores. String parameter values can be up to 100 characters long.
* The "firebase_", "google_" and "ga_" prefixes are reserved and should not be used for parameter names.
*/
[key: string]: string | number;
}

export interface AddPaymentInfoEventParameters {
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 @@ -15,7 +15,7 @@
*/
import struct from '@react-native-firebase/app/lib/common/struct';

const Item = struct({
const Item = struct.interface({
Pietahr marked this conversation as resolved.
Show resolved Hide resolved
item_brand: 'string?',
item_id: 'string?',
item_name: 'string?',
Expand Down
Loading