1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
service.php
См. документацию.
1
<?php
8
9
namespace
Bitrix\Sender\Integration\Seo\Ads;
10
11
use Bitrix\Main\Loader;
12
use Bitrix\Sender\Integration;
13
use Bitrix\Seo\Retargeting;
14
19
class
Service
20
{
26
public
static
function
canUse
()
27
{
28
if
(!
Loader::includeModule
(
'seo'
))
29
{
30
return
false
;
31
}
32
33
return
Retargeting\AdsAudience::canUse
();
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,
60
MessageBase::CODE_ADS_LOOKALIKE_YANDEX
=>
Retargeting
\Service::TYPE_YANDEX,
61
);
62
}
63
70
public
static
function
getAdsProvider
($adsType,
$clientId
=
null
)
71
{
72
$service
=
Retargeting\AdsAudience::getService
();
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
$type
Определения
options.php:106
$provider
if(!Loader::includeModule('messageservice')) $provider
Определения
callback_ednaruimhpx.php:21
Bitrix\Main\Loader\includeModule
static includeModule($moduleName)
Определения
loader.php:67
Bitrix\Sender\Integration\Bitrix24\Service\isAdAvailable
static isAdAvailable()
Определения
service.php:68
Bitrix\Sender\Integration\Seo\Ads\MessageBase\CODE_ADS_GA
const CODE_ADS_GA
Определения
messagebase.php:31
Bitrix\Sender\Integration\Seo\Ads\MessageBase\CODE_ADS_LOOKALIKE_FB
const CODE_ADS_LOOKALIKE_FB
Определения
messagebase.php:32
Bitrix\Sender\Integration\Seo\Ads\MessageBase\CODE_ADS_LOOKALIKE_VK
const CODE_ADS_LOOKALIKE_VK
Определения
messagebase.php:33
Bitrix\Sender\Integration\Seo\Ads\MessageBase\CODE_ADS_YA
const CODE_ADS_YA
Определения
messagebase.php:30
Bitrix\Sender\Integration\Seo\Ads\MessageBase\CODE_ADS_FB
const CODE_ADS_FB
Определения
messagebase.php:29
Bitrix\Sender\Integration\Seo\Ads\MessageBase\CODE_ADS_LOOKALIKE_YANDEX
const CODE_ADS_LOOKALIKE_YANDEX
Определения
messagebase.php:34
Bitrix\Sender\Integration\Seo\Ads\MessageBase\CODE_ADS_VK
const CODE_ADS_VK
Определения
messagebase.php:28
Bitrix\Sender\Integration\Seo\Ads\Service\getTypeMap
static getTypeMap()
Определения
service.php:51
Bitrix\Sender\Integration\Seo\Ads\Service\canUse
static canUse()
Определения
service.php:26
Bitrix\Sender\Integration\Seo\Ads\Service\send
static send(\stdClass $config, array $contacts)
Определения
service.php:101
Bitrix\Sender\Integration\Seo\Ads\Service\isAvailable
static isAvailable()
Определения
service.php:41
Bitrix\Sender\Integration\Seo\Ads\Service\getAdsProvider
static getAdsProvider($adsType, $clientId=null)
Определения
service.php:70
Bitrix\Seo\Retargeting\AdsAudience\getService
static getService()
Определения
adsaudience.php:46
Bitrix\Seo\Retargeting\AdsAudience\getProviders
static getProviders(array $types=null)
Определения
adsaudience.php:201
Bitrix\Seo\Retargeting\AdsAudience\canUse
static canUse()
Определения
adsaudience.php:26
Bitrix\Seo\Retargeting\Service\getAudience
static getAudience($type)
Определения
service.php:49
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
Bitrix\Main\Service
Bitrix\Seo\Retargeting
Определения
account.php:3
$service
$service
Определения
payment.php:18
$config
$config
Определения
quickway.php:69
$clientId
$clientId
Определения
seo_client.php:18
bitrix
modules
sender
lib
integration
seo
ads
service.php
Создано системой
1.14.0