From 3a5d7c93a4d1dc9b3a7d7b677a57670a3eb8057d Mon Sep 17 00:00:00 2001 From: Ho Chia Leung Date: Thu, 25 May 2023 09:27:48 +0200 Subject: [PATCH] HuaweiAds: Handle getDeviceIDFromUserExt when ifa and user.ext are set (#2796) --- adapters/huaweiads/huaweiads.go | 3 + .../exemplary/banner1_without_userext.json | 251 ++++++++++++++++++ 2 files changed, 254 insertions(+) create mode 100644 adapters/huaweiads/huaweiadstest/exemplary/banner1_without_userext.json diff --git a/adapters/huaweiads/huaweiads.go b/adapters/huaweiads/huaweiads.go index 4944fd5e2f0..7867aefac97 100644 --- a/adapters/huaweiads/huaweiads.go +++ b/adapters/huaweiads/huaweiads.go @@ -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 diff --git a/adapters/huaweiads/huaweiadstest/exemplary/banner1_without_userext.json b/adapters/huaweiads/huaweiadstest/exemplary/banner1_without_userext.json new file mode 100644 index 00000000000..9d944484950 --- /dev/null +++ b/adapters/huaweiads/huaweiadstest/exemplary/banner1_without_userext.json @@ -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": " ", + "adomain": [ + "huaweiads" + ], + "crid": "58025103", + "id": "test-imp-id", + "impid": "test-imp-id", + "price": 2.8, + "h": 300, + "w": 250 + }, + "type": "banner" + } + ] + } + ] +} \ No newline at end of file