Skip to content

Commit ce3bdec

Browse files
committed
parse protocol and hostname from referer before populating payload
1 parent 99a8a39 commit ce3bdec

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

modules/playgroundxyzBidAdapter.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,21 @@ export const spec = {
2828
* @return ServerRequest Info describing the request to the server.
2929
*/
3030
buildRequests: function (bidRequests, bidderRequest) {
31-
const topLocation = bidderRequest.refererInfo.referer;
31+
const referer = bidderRequest.refererInfo.referer;
32+
const parts = referer.split('/');
33+
34+
let protocol, hostname;
35+
if (parts.length >= 3) {
36+
protocol = parts[0];
37+
hostname = parts[2];
38+
}
39+
3240
const payload = {
3341
id: bidRequests[0].auctionId,
3442
site: {
35-
domain: window.location.protocol + '//' + topLocation.hostname,
36-
name: topLocation.hostname,
37-
page: topLocation.href,
43+
domain: protocol + '//' + hostname,
44+
name: hostname,
45+
page: referer,
3846
},
3947
device: {
4048
ua: navigator.userAgent,

0 commit comments

Comments
 (0)