1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
service.php
См. документацию.
1<?php
8
9namespace Bitrix\Sender\Integration\Seo\Ads;
10
11use Bitrix\Main\Loader;
12use Bitrix\Sender\Integration;
13use Bitrix\Seo\Retargeting;
14
20{
26 public static function canUse()
27 {
28 if (!Loader::includeModule('seo'))
29 {
30 return false;
31 }
32
34 }
35
41 public static function isAvailable()
42 {
43 return self::canUse() && Integration\Bitrix24\Service::isAdAvailable();
44 }
45
51 public static function getTypeMap()
52 {
53 return array(
54 MessageBase::CODE_ADS_FB => Retargeting\Service::TYPE_FACEBOOK,
55 MessageBase::CODE_ADS_VK => Retargeting\Service::TYPE_VKONTAKTE,
56 MessageBase::CODE_ADS_YA => Retargeting\Service::TYPE_YANDEX,
57 MessageBase::CODE_ADS_GA => Retargeting\Service::TYPE_GOOGLE,
58 MessageBase::CODE_ADS_LOOKALIKE_FB => Retargeting\Service::TYPE_FACEBOOK,
59 MessageBase::CODE_ADS_LOOKALIKE_VK => Retargeting\Service::TYPE_VKONTAKTE,
61 );
62 }
63
70 public static function getAdsProvider($adsType, $clientId = null)
71 {
73 $service->setClientId($clientId);
74 $providers = Retargeting\AdsAudience::getProviders([$adsType]);
75 $isFound = false;
76 $provider = array();
77 foreach ($providers as $type => $provider)
78 {
79 if ($type == $adsType)
80 {
81 $isFound = true;
82 break;
83 }
84 }
85
86 if (!$isFound)
87 {
88 return null;
89 }
90
91 return $provider;
92 }
93
101 public static function send(\stdClass $config, array $contacts)
102 {
103 if (!static::canUse())
104 {
105 return false;
106 }
107
108 $audience = Retargeting\Service::getAudience($config->type);
109 $audience->setAccountId($config->accountId);
110 $audience->enableQueueMode();
111
112 if ($config->autoRemoveDayNumber)
113 {
114 $audience->enableQueueAutoRemove($config->autoRemoveDayNumber);
115 }
116 else
117 {
118 $audience->disableQueueAutoRemove();
119 }
120
121 $audienceImportResult = $audience->addContacts(
122 $config->audienceId,
123 $contacts,
124 array(
125 'type' => $config->contactType
126 )
127 );
128
129 return $audienceImportResult->isSuccess();
130 }
131}
$type
Определения options.php:106
if(!Loader::includeModule('messageservice')) $provider
Определения callback_ednaruimhpx.php:21
static includeModule($moduleName)
Определения loader.php:67
static send(\stdClass $config, array $contacts)
Определения service.php:101
static getAdsProvider($adsType, $clientId=null)
Определения service.php:70
static getService()
Определения adsaudience.php:46
static getProviders(array $types=null)
Определения adsaudience.php:201
static getAudience($type)
Определения service.php:49
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$service
Определения payment.php:18
$config
Определения quickway.php:69
$clientId
Определения seo_client.php:18