Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New adapter "Cointraffic" added #5695

Merged
merged 3 commits into from
Sep 9, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removed mobile detection
  • Loading branch information
stsepelin committed Sep 3, 2020
commit c4fc3883f892a93d82f45498c480227fa20175f1
27 changes: 0 additions & 27 deletions modules/cointrafficBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,6 @@ import {registerBidder} from '../src/adapters/bidderFactory.js';
const BIDDER_CODE = 'cointraffic';
const ENDPOINT_URL = 'https://appspb.cointraffic.io/pb/tmp';

function detectDevice() {
let hasTouchScreen
if ('maxTouchPoints' in navigator) {
hasTouchScreen = navigator.maxTouchPoints > 0
} else {
let mQ = window.matchMedia && matchMedia('(pointer:coarse)')
if (mQ && mQ.media === '(pointer:coarse)') {
hasTouchScreen = !!mQ.matches
} else if ('orientation' in window) {
hasTouchScreen = true // deprecated, but good fallback
} else {
// Only as a last resort, fall back to user agent sniffing
let UA = navigator.userAgent
hasTouchScreen = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA)
}
}

return hasTouchScreen && window.innerWidth < 1280 ? 'mobile' : 'desktop'
}

export const spec = {
code: BIDDER_CODE,

Expand All @@ -45,18 +25,11 @@ export const spec = {
* @return Array Info describing the request to the server.
*/
buildRequests: function (validBidRequests, bidderRequest) {
if (validBidRequests.length === 0) {
return [];
}

const device = detectDevice()

return validBidRequests.map(bidRequest => {
const sizes = utils.parseSizesInput(bidRequest.params.size || bidRequest.sizes);

const payload = {
placementId: bidRequest.params.placementId,
device: device,
sizes: sizes,
bidId: bidRequest.bidId,
referer: bidderRequest.refererInfo.referer,
Expand Down
8 changes: 4 additions & 4 deletions test/spec/modules/cointrafficBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('cointrafficBidAdapter', function () {
let bid = {
bidder: 'cointraffic',
params: {
placementId: 'ct_testPlacementId'
placementId: 'testPlacementId'
},
adUnitCode: 'adunit-code',
sizes: [
Expand All @@ -29,7 +29,7 @@ describe('cointrafficBidAdapter', function () {
{
bidder: 'cointraffic',
params: {
placementId: 'ct_testPlacementId'
placementId: 'testPlacementId'
},
adUnitCode: 'adunit-code',
sizes: [
Expand All @@ -42,7 +42,7 @@ describe('cointrafficBidAdapter', function () {
{
bidder: 'cointraffic',
params: {
placementId: 'ct_testPlacementId'
placementId: 'testPlacementId'
},
adUnitCode: 'adunit-code2',
sizes: [
Expand Down Expand Up @@ -83,7 +83,7 @@ describe('cointrafficBidAdapter', function () {
method: 'POST',
url: ENDPOINT_URL,
data: {
placementId: 'ct_testPlacementId',
placementId: 'testPlacementId',
device: 'desktop',
sizes: ['300x250'],
bidId: 'bidId12345',
Expand Down