Skip to content

Commit

Permalink
HuaweiAds: Handle getDeviceIDFromUserExt when ifa and user.ext are set (
Browse files Browse the repository at this point in the history
  • Loading branch information
clho40 committed May 25, 2023
1 parent 708d917 commit 3a5d7c9
Show file tree
Hide file tree
Showing 2 changed files with 254 additions and 0 deletions.
3 changes: 3 additions & 0 deletions adapters/huaweiads/huaweiads.go
Expand Up @@ -817,6 +817,9 @@ func getDeviceIDFromUserExt(device *device, openRTBRequest *openrtb2.BidRequest)
device.Gaid = deviceId.Gaid[0]
isValidDeviceId = true
}
if len(device.Gaid) > 0 {
isValidDeviceId = true
}
if len(deviceId.Imei) > 0 {
device.Imei = deviceId.Imei[0]
isValidDeviceId = true
Expand Down
@@ -0,0 +1,251 @@
{
"mockBidRequest": {
"id": "test-req-id",
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [
{
"w": 300,
"h": 250
}
],
"w": 300,
"h": 250
},
"ext": {
"bidder": {
"slotid": "m8x9x3rzff",
"adtype": "banner",
"publisherid": "123",
"signkey": "signkey",
"keyid": "41",
"isTestAuthorization": "true"
}
}
}
],
"app": {
"bundle": "com.example.p1",
"name": "Huawei Browser",
"ver": "9.1.0.301",
"content": {
"language": "zh"
}
},
"device": {
"ua": "useragent",
"h": 1920,
"language": "zh",
"model": "COL-TEST",
"os": "android",
"osv": "10.0.0",
"devicetype": 4,
"make": "huawei",
"w": 1080,
"ip": "ip",
"ifa": "e4fe9bde-caa0-47b6-908d-ffba3fa184f2",
"pxratio": 23.01,
"mccmnc": "460",
"geo": {
"country": "CHN"
}
},
"user": {
"ext": {
"data": {
"clientTime": [
"2018-11-02 16:34:07.981+1300"
]
},
"consent": "CPaYLJBPaYLJBIPAAAENCSCgAPAAAAAAAAAAGsQAQGsAAAAA.YAAAAAAAAAA"
}
},
"regs": {
"coppa": 1
},
"ext": {
}
},
"httpcalls": [
{
"expectedRequest": {
"uri": "https://acd.op.hicloud.com/ppsadx/getResult",
"headers": {
"Accept": [
"application/json"
],
"Content-Type": [
"application/json;charset=utf-8"
],
"User-Agent": [
"useragent"
],
"Authorization": [
"Digest username=123,realm=ppsadx/getResult,nonce=1629473330823,response=d1d61a13a83e1468aa4dff5c8a6cee0b8b381173ca3eb6fa9b313937684d87c0,algorithm=HmacSHA256,usertype=1,keyid=41"
]
},
"body": {
"app": {
"lang": "zh",
"country": "CN",
"name": "Huawei Browser",
"pkgname": "com.example.pkgname1",
"version": "9.1.0.301"
},
"multislot": [
{
"adtype": 8,
"slotid": "m8x9x3rzff",
"test": 1,
"format": [
{
"w": 300,
"h": 250
}
],
"w": 300,
"h": 250
}
],
"device": {
"height": 1920,
"language": "zh",
"os": "android",
"type": 4,
"ip": "ip",
"localeCountry": "CN",
"pxratio": 23.01,
"width": 1080,
"clientTime": "2018-11-02 16:34:07.981+1300",
"gaid": "e4fe9bde-caa0-47b6-908d-ffba3fa184f2",
"useragent": "useragent",
"version": "10.0.0",
"maker": "huawei",
"model": "COL-TEST",
"belongCountry": "CN"
},
"geo": {
},
"network": {
"type": 0
},
"regs": {
"coppa": 1
},
"consent": "CPaYLJBPaYLJBIPAAAENCSCgAPAAAAAAAAAAGsQAQGsAAAAA.YAAAAAAAAAA",
"version": "3.4",
"clientAdRequestId": "test-req-id"
}
},
"mockResponse": {
"status": 200,
"body": {
"ctrlSwitchs": "0",
"dsp1cost": 61,
"dspcost": 108,
"multiad": [
{
"adtype": 8,
"brsetting": "Y",
"content": [
{
"clickActionList": [
1
],
"contentid": "58025103",
"creativetype": 2,
"ctrlSwitchs": "001011001001010112",
"endtime": 1621428898335,
"filterList": [
3
],
"interactiontype": 1,
"landingTitle": 1,
"metaData": {
"adSign": "2",
"appPromotionChannel": "401721412",
"clickUrl": "https://ads.huawei.com/usermgtportal/home/index.html#/",
"imageInfo": [
{
"checkSha256Flag": 1,
"height": 300,
"imageType": "img",
"sha256": "f5d8487cddaecec45b73fc078649478c80ec646bfec8ed7da4ff931f90eab232",
"url": "https://ads.huawei.com/usermgtportal/home/img/huawei_logo_black.aaec817d.svg",
"width": 250
}
],
"label": "Banner_API",
"landingPageType": "3"
},
"monitor": [
{
"eventType": "click",
"url": [
"http://test/click1",
"http://test/click2",
"http://test/click3"
]
},
{
"eventType": "imp",
"url": [
"http://test/imp1",
"http://test/imp2",
"http://test/imp3"
]
}
],
"paramfromserver": {
"a": "1||test",
"sig": "",
"t": "99990101235959"
},
"price": 2.8,
"starttime": 1621267200000,
"taskid": "48017658"
}
],
"retcode30": 200,
"slotid": "m8x9x3rzff"
}
],
"noReportAdTypeEventList": [
{
"adType": 8,
"eventTypeList": [
"exception_6"
]
}
],
"retcode": 200,
"totalCacheSize": 300
}
}
}
],
"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"adm": "<style> html, body { margin: 0; padding: 0; width: 100%; height: 100%; vertical-align: middle; } html { display: table; } body { display: table-cell; vertical-align: middle; text-align: center; -webkit-text-size-adjust: none; } </style> <span class=\"title-link advertiser_label\"></span> <a href='https://ads.huawei.com/usermgtportal/home/index.html#/' style=\"text-decoration:none\" onclick=sendGetReq()> <img src='https://ads.huawei.com/usermgtportal/home/img/huawei_logo_black.aaec817d.svg' width='250' height='300'/> </a> <img height=\"1\" width=\"1\" src='http://test/imp1' > <img height=\"1\" width=\"1\" src='http://test/imp2' > <img height=\"1\" width=\"1\" src='http://test/imp3' > <script type=\"text/javascript\">var dspClickTrackings = [\"http://test/click1\",\"http://test/click2\",\"http://test/click3\"];function sendGetReq() {sendSomeGetReq(dspClickTrackings)}function sendOneGetReq(url) {var req = new XMLHttpRequest();req.open('GET', url, true);req.send(null);}function sendSomeGetReq(urls) {for (var i = 0; i < urls.length; i++) {sendOneGetReq(urls[i]);}}</script>",
"adomain": [
"huaweiads"
],
"crid": "58025103",
"id": "test-imp-id",
"impid": "test-imp-id",
"price": 2.8,
"h": 300,
"w": 250
},
"type": "banner"
}
]
}
]
}

0 comments on commit 3a5d7c9

Please sign in to comment.