Skip to content

Commit d55e891

Browse files
Pietahrmikehardy
authored andcommitted
feat(analytics): allow custom event parameters for Item in events
1 parent a5feba3 commit d55e891

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

packages/analytics/__tests__/analytics.test.ts

+6
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,12 @@ describe('Analytics', function () {
311311
}),
312312
).toThrowError('firebase.analytics().logAddToWishlist(*):');
313313
});
314+
315+
it('items accept arbitrary custom event parameters', function () {
316+
expect(() =>
317+
firebase.analytics().logAddToWishlist({ items: [{ foo: 'bar' }] }),
318+
).not.toThrow();
319+
});
314320
});
315321

316322
describe('logBeginCheckout()', function () {

packages/analytics/lib/index.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ export namespace FirebaseAnalyticsTypes {
141141
* The promotion name associated with the item.
142142
*/
143143
promotion_name?: string;
144+
/**
145+
* 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.
146+
* The "firebase_", "google_" and "ga_" prefixes are reserved and should not be used for parameter names.
147+
*/
148+
[key: string]: string | number;
144149
}
145150

146151
export interface AddPaymentInfoEventParameters {

packages/analytics/lib/structs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
import struct from '@react-native-firebase/app/lib/common/struct';
1717

18-
const Item = struct({
18+
const Item = struct.interface({
1919
item_brand: 'string?',
2020
item_id: 'string?',
2121
item_name: 'string?',

0 commit comments

Comments
 (0)