コード例 #1
0
ファイル: RtbBuyV22Bid.php プロジェクト: cloudseo/nginad
 protected function logImpressionsStatisticsData($tld, $total_bids, $spend_offered_in_bids)
 {
     if ($this->RtbBidRequest != null) {
         /*
          * CREATE AN HOURLY TALLY OF INCOMING RTB BIDS
          * FROM BOTH LOCAL PUBS AND REMOTE SSP RTB SITE ID
          * CHANNELS IN ORDER TO PROVIDE THE SITE SCOUT
          * RTB CHANNEL CHOOSER FUNCTIONALITY IN AN EXCEL LIKE
          * GRID LAYOUT WITH THE DAILY IMPS IN A SORTABLE COLUMN
          */
         $buyside_partner_name = $this->rtb_ssp_friendly_name;
         $rtb_channel_site_domain = $tld;
         $auction_bids_counter = $total_bids;
         $rtb_ids = \util\WorkflowHelper::getIdsFromRtbRequest($this->RtbBidRequest);
         $rtb_channel_site_id = $rtb_ids["rtb_channel_site_id"];
         $rtb_channel_site_name = $rtb_ids["rtb_channel_site_name"];
         $rtb_channel_publisher_name = $rtb_ids["rtb_channel_publisher_name"];
         $rtb_channel_site_iab_category = $rtb_ids["rtb_channel_site_iab_category"];
         $impressions_offered_counter = $rtb_ids["impressions_offered_counter"];
         $floor_price_if_any = 0;
         if (isset($this->RtbBidRequest->RtbBidRequestImpList) && is_array($this->RtbBidRequest->RtbBidRequestImpList)) {
             foreach ($this->RtbBidRequest->RtbBidRequestImpList as $RtbBidRequestImp) {
                 if (isset($RtbBidRequestImp->bidfloor) && $RtbBidRequestImp->bidfloor > $floor_price_if_any) {
                     $floor_price_if_any = floatval($RtbBidRequestImp->bidfloor);
                 }
             }
         }
         $method_params = array("buyside_partner_name" => $buyside_partner_name, "rtb_channel_site_id" => $rtb_channel_site_id, "rtb_channel_site_name" => $rtb_channel_site_name, "rtb_channel_site_domain" => $rtb_channel_site_domain, "rtb_channel_site_iab_category" => $rtb_channel_site_iab_category, "rtb_channel_publisher_name" => $rtb_channel_publisher_name, "impressions_offered_counter" => $impressions_offered_counter, "auction_bids_counter" => $auction_bids_counter, "spend_offered_in_bids" => $spend_offered_in_bids, "floor_price_if_any" => $floor_price_if_any);
         if ($this->is_local_request === true) {
             /*
              * In the local context, $rtb_channel_site_id is the PublisherWebsiteID
              */
             $PrivateExchangeRtbChannelDailyStatsFactory = \_factory\PrivateExchangeRtbChannelDailyStats::get_instance();
             $PrivateExchangeRtbChannelDailyStatsFactory->incrementPrivateExchangeRtbChannelDailyStatsCached($this->config, $method_params);
         } else {
             $SspRtbChannelDailyStatsFactory = \_factory\SspRtbChannelDailyStats::get_instance();
             $SspRtbChannelDailyStatsFactory->incrementSspRtbChannelDailyStatsCached($this->config, $method_params);
         }
     }
 }
コード例 #2
0
 public function incrementPrivateExchangeRtbChannelDailyStats($config, $current)
 {
     if (!is_array($current)) {
         return;
     }
     $PrivateExchangeRtbChannelDailyStatsFactory = \_factory\PrivateExchangeRtbChannelDailyStats::get_instance();
     foreach ($current as $publisher_website_id => $method_params) {
         $publisher_website_id = $method_params["publisher_website_id"];
         $rtb_channel_site_name = $method_params["rtb_channel_site_name"];
         $impressions_offered_counter = $method_params["impressions_offered_counter"];
         $auction_bids_counter = $method_params["auction_bids_counter"];
         $spend_offered_in_bids = $method_params["spend_offered_in_bids"];
         $floor_price_if_any = $method_params["floor_price_if_any"];
         $current_hour = date("m/d/Y H");
         $current_day = date("m/d/Y");
         $params = array();
         $params["PublisherWebsiteID"] = $publisher_website_id;
         $params["MDYH"] = $current_hour;
         $PrivateExchangeRtbChannelDailyStats = $PrivateExchangeRtbChannelDailyStatsFactory->get_row($params);
         $private_exchange_rtb_channel_daily_stats = new \model\PrivateExchangeRtbChannelDailyStats();
         $private_exchange_rtb_channel_daily_stats->PublisherWebsiteID = $publisher_website_id;
         $private_exchange_rtb_channel_daily_stats->BidFloor = $floor_price_if_any;
         $private_exchange_rtb_channel_daily_stats->RtbChannelSiteName = $rtb_channel_site_name;
         if ($PrivateExchangeRtbChannelDailyStats != null) {
             $private_exchange_rtb_channel_daily_stats->PrivateExchangeRtbChannelDailyStatsID = $PrivateExchangeRtbChannelDailyStats->PrivateExchangeRtbChannelDailyStatsID;
             $private_exchange_rtb_channel_daily_stats->ImpressionsOfferedCounter = $PrivateExchangeRtbChannelDailyStats->ImpressionsOfferedCounter + $impressions_offered_counter;
             $private_exchange_rtb_channel_daily_stats->AuctionBidsCounter = $PrivateExchangeRtbChannelDailyStats->AuctionBidsCounter + $auction_bids_counter;
             $private_exchange_rtb_channel_daily_stats->BidTotalAmount = $PrivateExchangeRtbChannelDailyStats->BidTotalAmount + $spend_offered_in_bids;
             $PrivateExchangeRtbChannelDailyStatsFactory->updatePrivateExchangeRtbChannelDailyStats($private_exchange_rtb_channel_daily_stats);
         } else {
             $private_exchange_rtb_channel_daily_stats->MDYH = $current_hour;
             $private_exchange_rtb_channel_daily_stats->MDY = $current_day;
             $private_exchange_rtb_channel_daily_stats->ImpressionsOfferedCounter = $impressions_offered_counter;
             $private_exchange_rtb_channel_daily_stats->AuctionBidsCounter = $auction_bids_counter;
             $private_exchange_rtb_channel_daily_stats->BidTotalAmount = $spend_offered_in_bids;
             $private_exchange_rtb_channel_daily_stats->DateCreated = date("Y-m-d H:i:s");
             $PrivateExchangeRtbChannelDailyStatsFactory->insertPrivateExchangeRtbChannelDailyStats($private_exchange_rtb_channel_daily_stats);
         }
     }
 }
コード例 #3
0
ファイル: RtbBuyV22Bid.php プロジェクト: heinnge/nginad
 protected function logImpressionsStatisticsData($tld, $total_bids, $spend_offered_in_bids)
 {
     if ($this->RtbBidRequest != null) {
         /*
          * CREATE AN HOURLY TALLY OF INCOMING RTB BIDS
          * FROM BOTH LOCAL PUBS AND REMOTE SSP RTB SITE ID
          * CHANNELS IN ORDER TO PROVIDE THE SITE SCOUT
          * RTB CHANNEL CHOOSER FUNCTIONALITY IN AN EXCEL LIKE
          * GRID LAYOUT WITH THE DAILY IMPS IN A SORTABLE COLUMN
          */
         $buyside_partner_name = $this->rtb_ssp_friendly_name;
         $rtb_channel_site_id = "N/A";
         $rtb_channel_site_name = "N/A";
         $rtb_channel_publisher_name = "N/A";
         $rtb_channel_site_domain = $tld;
         $rtb_channel_site_iab_category = null;
         $impressions_offered_counter = 0;
         $auction_bids_counter = $total_bids;
         if (isset($this->RtbBidRequest->RtbBidRequestSite->id)) {
             $rtb_channel_site_id = $this->RtbBidRequest->RtbBidRequestSite->id;
         } elseif (isset($this->RtbBidRequest->RtbBidRequestApp->id)) {
             $rtb_channel_site_id = $this->RtbBidRequest->RtbBidRequestApp->id;
         }
         if (isset($this->RtbBidRequest->RtbBidRequestSite->name)) {
             $rtb_channel_site_name = $this->RtbBidRequest->RtbBidRequestSite->name;
         } elseif (isset($this->RtbBidRequest->RtbBidRequestApp->name)) {
             $rtb_channel_site_name = $this->RtbBidRequest->RtbBidRequestApp->name;
         }
         if (isset($this->RtbBidRequest->RtbBidRequestSite->RtbBidRequestPublisher->name)) {
             $rtb_channel_publisher_name = $this->RtbBidRequest->RtbBidRequestSite->RtbBidRequestPublisher->name;
         } elseif (isset($this->RtbBidRequest->RtbBidRequestApp->RtbBidRequestPublisher->name)) {
             $rtb_channel_publisher_name = $this->RtbBidRequest->RtbBidRequestApp->RtbBidRequestPublisher->name;
         }
         if (isset($this->RtbBidRequest->RtbBidRequestSite->cat[0])) {
             $rtb_channel_site_iab_category = $this->RtbBidRequest->RtbBidRequestSite->cat[0];
         } elseif (isset($this->RtbBidRequest->RtbBidRequestApp->cat[0])) {
             $rtb_channel_site_iab_category = $this->RtbBidRequest->RtbBidRequestApp->cat[0];
         }
         if ($rtb_channel_site_iab_category === null && isset($this->RtbBidRequest->RtbBidRequestSite->sectioncat[0])) {
             $rtb_channel_site_iab_category = $this->RtbBidRequest->RtbBidRequestSite->sectioncat[0];
         } elseif ($rtb_channel_site_iab_category === null && isset($this->RtbBidRequest->RtbBidRequestApp->sectioncat[0])) {
             $rtb_channel_site_iab_category = $this->RtbBidRequest->RtbBidRequestApp->sectioncat[0];
         }
         if ($rtb_channel_site_iab_category === null && isset($this->RtbBidRequest->RtbBidRequestSite->pagecat[0])) {
             $rtb_channel_site_iab_category = $this->RtbBidRequest->RtbBidRequestSite->pagecat[0];
         } elseif ($rtb_channel_site_iab_category === null && isset($this->RtbBidRequest->RtbBidRequestApp->pagecat[0])) {
             $rtb_channel_site_iab_category = $this->RtbBidRequest->RtbBidRequestApp->pagecat[0];
         }
         if ($rtb_channel_site_iab_category !== null) {
             $rtb_channel_site_iab_category = array_search($rtb_channel_site_iab_category, \buyrtb\parsers\openrtb\parselets\common\ParseWebsite::$vertical_map);
         }
         if ($rtb_channel_site_iab_category === null || $rtb_channel_site_iab_category === false) {
             $rtb_channel_site_iab_category = "N/A";
         }
         if (isset($this->RtbBidRequest->RtbBidRequestImpList) && is_array($this->RtbBidRequest->RtbBidRequestImpList)) {
             $impressions_offered_counter = count($this->RtbBidRequest->RtbBidRequestImpList);
         }
         $floor_price_if_any = 0;
         if (isset($this->RtbBidRequest->RtbBidRequestImpList) && is_array($this->RtbBidRequest->RtbBidRequestImpList)) {
             foreach ($this->RtbBidRequest->RtbBidRequestImpList as $RtbBidRequestImp) {
                 if (isset($RtbBidRequestImp->bidfloor) && $RtbBidRequestImp->bidfloor > $floor_price_if_any) {
                     $floor_price_if_any = floatval($RtbBidRequestImp->bidfloor);
                 }
             }
         }
         $method_params = array("buyside_partner_name" => $buyside_partner_name, "rtb_channel_site_id" => $rtb_channel_site_id, "rtb_channel_site_name" => $rtb_channel_site_name, "rtb_channel_site_domain" => $rtb_channel_site_domain, "rtb_channel_site_iab_category" => $rtb_channel_site_iab_category, "rtb_channel_publisher_name" => $rtb_channel_publisher_name, "impressions_offered_counter" => $impressions_offered_counter, "auction_bids_counter" => $auction_bids_counter, "spend_offered_in_bids" => $spend_offered_in_bids, "floor_price_if_any" => $floor_price_if_any);
         if ($this->is_local_request === true) {
             /*
              * In the local context, $rtb_channel_site_id is the PublisherWebsiteID
              */
             $PrivateExchangeRtbChannelDailyStatsFactory = \_factory\PrivateExchangeRtbChannelDailyStats::get_instance();
             $PrivateExchangeRtbChannelDailyStatsFactory->incrementPrivateExchangeRtbChannelDailyStatsCached($this->config, $method_params);
         } else {
             $SspRtbChannelDailyStatsFactory = \_factory\SspRtbChannelDailyStats::get_instance();
             $SspRtbChannelDailyStatsFactory->incrementSspRtbChannelDailyStatsCached($this->config, $method_params);
         }
     }
 }