Skip to content

Commit

Permalink
fallback to content_ids.length when parsing number_items fails
Browse files Browse the repository at this point in the history
  • Loading branch information
David Bordoley committed Mar 8, 2024
1 parent a31ee8f commit 05fdb21
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,15 @@ export const formatPayload = (payload: Payload, settings: Settings, isTest = tru
brands: products.map((product) => product.brand ?? ''),
num_items: products.length
}
: {
content_ids: splitListValueToArray(payload.item_ids ?? ''),
content_category: splitListValueToArray(payload.item_category ?? ''),
brands: payload.brands,
num_items: parseNumberSafe(payload.number_items)
}
: (() => {
const content_ids = splitListValueToArray(payload.item_ids ?? '')
return {
content_ids,
content_category: splitListValueToArray(payload.item_category ?? ''),
brands: payload.brands,
num_items: parseNumberSafe(payload.number_items) ?? content_ids?.length
}
})()

// FIXME: Ideally advertisers on iOS 14.5+ would pass the ATT_STATUS from the device.
// However the field is required for app events, so hardcode the value to false (0)
Expand Down

0 comments on commit 05fdb21

Please sign in to comment.