111 $config = $message->getConfiguration();
112 $clientId = $config->get(
'CLIENT_ID');
113 $audienceId = $config->get(
'AUDIENCE_ID');
114 $audiencePhoneId = $config->get(
'AUDIENCE_PHONE_ID');
115 $audienceEmailId = $config->get(
'AUDIENCE_EMAIL_ID');
118 $adsContactType =
null;
119 switch (Recipient\
Type::getId($message->getRecipientType()))
121 case Recipient\Type::EMAIL:
122 $adsContactType = Retargeting\Audience::ENUM_CONTACT_TYPE_EMAIL;
125 case Recipient\Type::PHONE:
126 $adsContactType = Retargeting\Audience::ENUM_CONTACT_TYPE_PHONE;
132 $audiences = array();
135 $audiences[] = array(
137 'contactType' => $adsContactType
140 if ($audiencePhoneId)
142 $audiences[] = array(
143 'id' => $audiencePhoneId,
144 'contactType' => Retargeting\Audience::ENUM_CONTACT_TYPE_PHONE
147 if ($audienceEmailId)
149 $audiences[] = array(
150 'id' => $audienceEmailId,
151 'contactType' => Retargeting\Audience::ENUM_CONTACT_TYPE_EMAIL
155 if (count($audiences) == 0)
165 foreach ($audiences as $audience)
167 $this->adsConfig->accountId = $config->get(
'ACCOUNT_ID');
168 $this->adsConfig->audienceId = $audience[
'id'];
169 $this->adsConfig->contactType = $audience[
'contactType'];
171 $this->adsConfig->autoRemoveDayNumber = $config->get(
'AUTO_REMOVE_DAY_NUMBER');
172 $this->adsConfig->parentId =
'sender:'.$config->getId();
174 if ($adsContactType !== $this->adsConfig->contactType)
179 $contacts[$adsContactType] = array($message->getRecipientCode());