Skip to content

Commit

Permalink
adds fix for custom props on track requests (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
cykolln authored Feb 6, 2024
1 parent e78b90f commit 5fb0e87
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions KlaviyoV3Sdk/KlaviyoV3Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,15 +432,18 @@ public function buildCustomerProperties($customerProperties)

$data = array(
self::TYPE_KEY_PAYLOAD => self::PROFILE_KEY_PAYLOAD,
self::ATTRIBUTE_KEY_PAYLOAD => $kl_properties,
self::PROPERTIES => $customerProperties,
self::ATTRIBUTE_KEY_PAYLOAD => $kl_properties
);

if (isset($customerProperties['$id'])) {
$data[self::ID_KEY_PAYLOAD] = $customerProperties['$id'];
unset($customerProperties['$id']);
}

if(!empty($customerProperties)) {
$data[self::ATTRIBUTE_KEY_PAYLOAD][self::PROPERTIES] = $customerProperties;
}

return array(
self::PROFILE_KEY_PAYLOAD => array(
self::DATA_KEY_PAYLOAD => $data
Expand Down

0 comments on commit 5fb0e87

Please sign in to comment.