예제 #1
0
 public static function onSetDayContextAttributes(DayContext $context)
 {
     $id = null;
     if (isset($_SESSION[self::CLICK_PARAM_NAME])) {
         $id = $_SESSION[self::CLICK_PARAM_NAME];
     }
     if (!is_numeric($id) || $id <= 0) {
         return;
     }
     $recipientDb = PostingRecipientTable::getList(array('select' => array('MAILING_CHAIN_ID' => 'POSTING.MAILING_CHAIN_ID'), 'filter' => array('ID' => $id)));
     if ($recipient = $recipientDb->fetch()) {
         $context->setAttribute('sender_chain_source', $recipient['MAILING_CHAIN_ID']);
     }
 }
예제 #2
0
 public static function OnSetDayContextAttributes(DayContext $context)
 {
     // Site
     if ($siteId = DayContext::getSiteId()) {
         $context->setAttribute('conversion_site', $siteId);
     }
     // Device
     $detect = new MobileDetect();
     if ($detect->isTablet()) {
         $context->setAttribute('conversion_device', 'tablet');
     } elseif ($detect->isMobile()) {
         $context->setAttribute('conversion_device', 'mobile');
     }
     // Referrer
     if ($referrer = $_SERVER['HTTP_REFERER']) {
         foreach (array('google' => '#^https?://www\\.google\\.[a-z]{2,3}/#', 'bing' => '#^https?://www\\.bing\\.[a-z]{2,3}/#', 'yahoo' => '#^https?://r\\.search\\.yahoo\\.[a-z]{2,3}/#', 'ask' => '#^https?://www\\.ask\\.[a-z]{2,3}/#', 'yandex' => '#^https?://yandex\\.[a-z]{2,3}/#', 'mail.ru' => '#^https?://go\\.mail\\.ru/#', 'rambler' => '#^https?://nova\\.rambler\\.ru/#') as $name => $regexp) {
             if (preg_match($regexp, $referrer)) {
                 $context->setAttribute('conversion_referrer_source', $name);
                 break;
             }
         }
     }
 }
예제 #3
0
 /**
  * Sets A/B-test related attributes to conversion context
  * 
  * @param \Bitrix\Conversion\DayContext $conversionContext Conversion context.
  * @return void
  */
 public static function onConversionSetContextAttributes(\Bitrix\Conversion\DayContext $conversionContext)
 {
     if ($abtest = Helper::getActiveTest()) {
         if ($context = Helper::getContext()) {
             if ($context['abtest'] != $abtest['ID']) {
                 return;
             }
             if (!in_array($context['section'], array('A', 'B'))) {
                 return;
             }
             $conversionContext->setAttribute('abtest', $context['abtest']);
             $conversionContext->setAttribute('abtest_section', $context['section']);
         }
     }
 }
예제 #4
0
 public static function onSetDayContextAttributes(DayContext $context)
 {
     if (AdvSession::isSession()) {
         $context->setAttribute('seo_yandex_direct_source', static::getSeoId());
     }
 }