From 5fb0e87ca33eca85dadd3af01838c741250e9bbe Mon Sep 17 00:00:00 2001 From: Claire Kolln <78871498+cykolln@users.noreply.github.com> Date: Tue, 6 Feb 2024 13:59:51 -0800 Subject: [PATCH] adds fix for custom props on track requests (#291) --- KlaviyoV3Sdk/KlaviyoV3Api.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/KlaviyoV3Sdk/KlaviyoV3Api.php b/KlaviyoV3Sdk/KlaviyoV3Api.php index a1e0b47..f22b727 100644 --- a/KlaviyoV3Sdk/KlaviyoV3Api.php +++ b/KlaviyoV3Sdk/KlaviyoV3Api.php @@ -432,8 +432,7 @@ 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'])) { @@ -441,6 +440,10 @@ public function buildCustomerProperties($customerProperties) 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