Skip to content

Commit

Permalink
Merge branch 'main' into fix/issues_74_80
Browse files Browse the repository at this point in the history
  • Loading branch information
nd4p90x authored Jul 31, 2024
2 parents c44674b + e45c723 commit ef41f4b
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions packages/plugins/plugin_firebase/lib/plugin_firebase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,22 @@ class FirebaseDestination extends DestinationPlugin {
try {
switch (event.event) {
case 'Product Clicked':
if (properties.containsKey('contentType') ||
properties.containsKey('itemId')) {
throw Exception("Missing properties: contentType and itemId");
if (!(properties.containsKey('list_id') ||
properties.containsKey('list_name') ||
properties.containsKey('name') ||
properties.containsKey('itemId')) ) {
throw Exception("Missing properties: list_name, list_id, name and itemID");
}

await FirebaseAnalytics.instance.logSelectContent(
contentType: properties['contentType'].toString(),
itemId: properties['itemId'].toString());
AnalyticsEventItem itemClicked = AnalyticsEventItem(
itemName: properties['name'].toString(),
itemId: properties['itemId'].toString());

await FirebaseAnalytics.instance.logSelectItem(
itemListName: properties['list_name'].toString(),
itemListId: properties['list_id'].toString(),
items:[itemClicked],
);
break;
case 'Product Viewed':
await FirebaseAnalytics.instance.logViewItem(
Expand Down

0 comments on commit ef41f4b

Please sign in to comment.