| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ce8d6dd commit bd589c6
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,22 +12,16 @@ import java.lang.Long.{toString => toStringBase} | |||
| 12 | 12 | import scala.util.{Success, Failure, Random} | |
| 13 | 13 | ||
| 14 | 14 | case class AdRequest( | |
| 15 | - load_id: String, // load_id | ||
| 16 | - zone_ids: List[Int], // zone_ids | ||
| 17 | - /* | ||
| 18 | - | ||
| 19 | - 229 970x250, 728x90 | ||
| 20 | - 228 300x250 | ||
| 21 | - | ||
| 22 | - */ | ||
| 23 | - ip: String, // ip | ||
| 24 | - user_agent: String, // user_agent | ||
| 25 | - url: String, // url | ||
| 26 | - referrer: Option[String], // referrer | ||
| 27 | - browser_dimensions: Option[String], // browser_dimensions | ||
| 15 | + load_id: String, | ||
| 16 | + zone_ids: List[Int], | ||
| 17 | + ip: String, | ||
| 18 | + user_agent: String, | ||
| 19 | + url: String, | ||
| 20 | + referrer: Option[String], | ||
| 21 | + browser_dimensions: Option[String], | ||
| 28 | 22 | switch_user_id: Option[String], // switch_user_id, SWID cookie | |
| 29 | - floor_price: Option[String], // floor_price | ||
| 30 | - targeting_variables: Option[String] // targeting_variables | ||
| 23 | + floor_price: Option[String], | ||
| 24 | + targeting_variables: Option[String] | ||
| 31 | 25 | ) | |
| 32 | 26 | ||
| 33 | 27 | object AdRequest { | |
@@ -48,7 +42,6 @@ class CommercialPreflightController(wsClient: WSClient) extends Controller with | |||
| 48 | 42 | val pageViewId = makeOphanViewId() | |
| 49 | 43 | ||
| 50 | 44 | val switchId = request.headers.get("X-GU-switch-id") | |
| 51 | - | ||
| 52 | 45 | val maybeClientIp = request.headers.get("X-GU-client-ip") | |
| 53 | 46 | val maybeTopUrl = request.headers.get("X-GU-topurl") | |
| 54 | 47 | val maybeUserAgent = request.headers.get("X-GU-user-agent") | |
@@ -58,9 +51,13 @@ class CommercialPreflightController(wsClient: WSClient) extends Controller with | |||
| 58 | 51 | topUrl <- maybeTopUrl | |
| 59 | 52 | userAgent <- maybeUserAgent | |
| 60 | 53 | } { | |
| 61 | - val adHubRequest = AdRequest( | ||
| 54 | + val adHubRequest = Json.toJson(AdRequest( | ||
| 62 | 55 | load_id = pageViewId, | |
| 63 | 56 | zone_ids = List(229, 228), | |
| 57 | + /* id sizes | ||
| 58 | + 229 970x250, 728x90 | ||
| 59 | + 228 300x250 | ||
| 60 | + */ | ||
| 64 | 61 | ip = clientIp, | |
| 65 | 62 | user_agent = userAgent, | |
| 66 | 63 | url = topUrl, | |
@@ -69,14 +66,12 @@ class CommercialPreflightController(wsClient: WSClient) extends Controller with | |||
| 69 | 66 | switch_user_id = switchId, | |
| 70 | 67 | floor_price = None, | |
| 71 | 68 | targeting_variables = None | |
| 72 | - ) | ||
| 73 | - | ||
| 74 | - log.logger.info(Json.toJson(adHubRequest).toString()) | ||
| 69 | + )) | ||
| 75 | 70 | ||
| 76 | - wsClient.url(Configuration.commercial.switchAdHubUrl) | ||
| 77 | - .post(Json.toJson(adHubRequest)) | ||
| 71 | + wsClient.url(Configuration.switch.switchAdHubUrl) | ||
| 72 | + .post(adHubRequest) | ||
| 78 | 73 | .onComplete({ | |
| 79 | - case Success(_) => log.logger.debug(s"switch ad call success for $clientIp, ${switchId.getOrElse("unknown user id")}") | ||
| 74 | + case Success(_) => log.logger.debug(s"switch ad call success for ${adHubRequest.toString()}, ${switchId.getOrElse("unknown user id")}") | ||
| 80 | 75 | case Failure(e) => log.logger.warn(s"switch ad call failed: ${e.getMessage}") | |
| 81 | 76 | }) | |
| 82 | 77 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments