forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SmartyadsBidAdapter remove usprivacy (prebid#11829)
* SmartyadsBidAdapter remove usprivacy * refactor * refactor * remove unusable code * try to fix duplicated code * try to fix duplicated code * smallfixes * smallfixes * smallfix * tests fix * revert fixes * remove language * move getAdUrlByRegion to libs * refactor * undo creative functions --------- Co-authored-by: vrishko <vasyl.rishko@smartyads.com>
- Loading branch information
1 parent
ebf22b6
commit ad44300
Showing
3 changed files
with
44 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const adUrls = { | ||
US_EAST: 'https://n1.smartyads.com/?c=o&m=prebid&secret_key=prebid_js', | ||
EU: 'https://n2.smartyads.com/?c=o&m=prebid&secret_key=prebid_js', | ||
SGP: 'https://n6.smartyads.com/?c=o&m=prebid&secret_key=prebid_js' | ||
}; | ||
|
||
export function getAdUrlByRegion(bid) { | ||
let adUrl; | ||
|
||
if (bid.params.region && adUrls[bid.params.region]) { | ||
adUrl = adUrls[bid.params.region]; | ||
} else { | ||
try { | ||
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; | ||
const region = timezone.split('/')[0]; | ||
|
||
switch (region) { | ||
case 'Europe': | ||
adUrl = adUrls['EU']; | ||
break; | ||
case 'Asia': | ||
adUrl = adUrls['SGP']; | ||
break; | ||
default: adUrl = adUrls['US_EAST']; | ||
} | ||
} catch (err) { | ||
adUrl = adUrls['US_EAST']; | ||
} | ||
} | ||
|
||
return adUrl; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters