From 9f3b17e0608d3b8ca12461d432dcbd58834439ec Mon Sep 17 00:00:00 2001 From: Ahmet Faruk Karakus Date: Fri, 1 Sep 2023 16:26:04 +0300 Subject: [PATCH] fix cta text empty and fill rate issue --- adapters/huaweiads/huaweiads.go | 13 ++++++++++--- .../huaweiadstest/exemplary/nativeIncludeVideo.json | 6 ++---- .../huaweiadstest/exemplary/nativeSingleImage.json | 5 ++--- .../huaweiadstest/exemplary/nativeThreeImage.json | 6 ++---- .../exemplary/nativeThreeImageIncludeIcon.json | 6 ++---- .../supplemental/bad_response_not_native.json | 4 +--- 6 files changed, 19 insertions(+), 21 deletions(-) diff --git a/adapters/huaweiads/huaweiads.go b/adapters/huaweiads/huaweiads.go index 071f0761bb3..6f87ef01b29 100644 --- a/adapters/huaweiads/huaweiads.go +++ b/adapters/huaweiads/huaweiads.go @@ -185,6 +185,7 @@ type metaData struct { ApkInfo apkInfo `json:"apkInfo"` Duration int64 `json:"duration"` MediaFile mediaFile `json:"mediaFile"` + Cta string `json:"cta"` } type imageInfo struct { @@ -535,8 +536,10 @@ func getNativeFormat(adslot30 *adslot30, openRTBImp *openrtb2.Imp) error { // only compute the main image number, type = native1.ImageAssetTypeMain var numMainImage = 0 var numVideo = 0 + /* to fix low fill rate issue var width int64 var height int64 + */ for _, asset := range nativePayload.Assets { // Only one of the {title,img,video,data} objects should be present in each object. if asset.Video != nil { @@ -547,19 +550,20 @@ func getNativeFormat(adslot30 *adslot30, openRTBImp *openrtb2.Imp) error { if asset.Img != nil { if asset.Img.Type == native1.ImageAssetTypeMain { numMainImage++ - if asset.Img.H != 0 && asset.Img.W != 0 { + /*if asset.Img.H != 0 && asset.Img.W != 0 { width = asset.Img.W height = asset.Img.H } else if asset.Img.WMin != 0 && asset.Img.HMin != 0 { width = asset.Img.WMin height = asset.Img.HMin - } + }*/ } continue } } + /* to fix low fill rate issue adslot30.W = width - adslot30.H = height + adslot30.H = height */ var detailedCreativeTypeList = make([]string, 0, 2) if numVideo >= 1 { @@ -1169,6 +1173,9 @@ func (a *adapter) extractAdmNative(adType int32, content *content, bidType openr dataObject.Label = "desc" dataObject.Value = getDecodeValue(content.MetaData.Description) } + if asset.Data.Type == native1.DataAssetTypeCTAText { + dataObject.Value = getDecodeValue(content.MetaData.Cta) + } responseAsset.Data = &dataObject } var id = asset.ID diff --git a/adapters/huaweiads/huaweiadstest/exemplary/nativeIncludeVideo.json b/adapters/huaweiads/huaweiadstest/exemplary/nativeIncludeVideo.json index 8a7ca1b0752..a83681ee107 100644 --- a/adapters/huaweiads/huaweiadstest/exemplary/nativeIncludeVideo.json +++ b/adapters/huaweiads/huaweiadstest/exemplary/nativeIncludeVideo.json @@ -95,9 +95,7 @@ "detailedCreativeTypeList": [ "903" ], - "h": 200, - "test": 1, - "w": 200 + "test": 1 } ], "device": { @@ -162,7 +160,7 @@ "appId": "101219405", "appPromotionChannel": "401721412", "clickUrl": "https://ads.huawei.com/usermgtportal/home/index.html#/", - "cta": "%e5%ae%89%e8%a3%85", + "cta": "%e6%9f%a5%e7%9c%8b%e8%af%a6%e6%83%85", "duration": 6038, "icon": [ { diff --git a/adapters/huaweiads/huaweiadstest/exemplary/nativeSingleImage.json b/adapters/huaweiads/huaweiadstest/exemplary/nativeSingleImage.json index 240098e038d..ba826e5d372 100644 --- a/adapters/huaweiads/huaweiadstest/exemplary/nativeSingleImage.json +++ b/adapters/huaweiads/huaweiadstest/exemplary/nativeSingleImage.json @@ -93,9 +93,7 @@ "detailedCreativeTypeList": [ "901" ], - "h": 200, - "test": 1, - "w": 200 + "test": 1 } ], "device": { @@ -168,6 +166,7 @@ "clickUrl": "https://ads.huawei.com/usermgtportal/home/index.html#/", "duration": 6038, "description": "", + "cta": "%e6%9f%a5%e7%9c%8b%e8%af%a6%e6%83%85", "icon": [ { "checkSha256Flag": 1, diff --git a/adapters/huaweiads/huaweiadstest/exemplary/nativeThreeImage.json b/adapters/huaweiads/huaweiadstest/exemplary/nativeThreeImage.json index 9b46072dd00..f12ec120292 100644 --- a/adapters/huaweiads/huaweiadstest/exemplary/nativeThreeImage.json +++ b/adapters/huaweiads/huaweiadstest/exemplary/nativeThreeImage.json @@ -92,9 +92,7 @@ "detailedCreativeTypeList": [ "904" ], - "h": 200, - "test": 1, - "w": 200 + "test": 1 } ], "device": { @@ -159,7 +157,7 @@ "appId": "101219405", "appPromotionChannel": "401721412", "clickUrl": "https://ads.huawei.com/usermgtportal/home/index.html#/", - "cta": "%e5%ae%89%e8%a3%85", + "cta": "%e6%9f%a5%e7%9c%8b%e8%af%a6%e6%83%85", "duration": 6038, "icon": [ { diff --git a/adapters/huaweiads/huaweiadstest/exemplary/nativeThreeImageIncludeIcon.json b/adapters/huaweiads/huaweiadstest/exemplary/nativeThreeImageIncludeIcon.json index f78f50e2f0f..9055179a2c3 100644 --- a/adapters/huaweiads/huaweiadstest/exemplary/nativeThreeImageIncludeIcon.json +++ b/adapters/huaweiads/huaweiadstest/exemplary/nativeThreeImageIncludeIcon.json @@ -93,9 +93,7 @@ "detailedCreativeTypeList": [ "904" ], - "h": 200, - "test": 1, - "w": 200 + "test": 1 } ], "device": { @@ -160,7 +158,7 @@ "appId": "101219405", "appPromotionChannel": "401721412", "clickUrl": "https://ads.huawei.com/usermgtportal/home/index.html#/", - "cta": "%e5%ae%89%e8%a3%85", + "cta": "%e6%9f%a5%e7%9c%8b%e8%af%a6%e6%83%85", "duration": 6038, "icon": [ { diff --git a/adapters/huaweiads/huaweiadstest/supplemental/bad_response_not_native.json b/adapters/huaweiads/huaweiadstest/supplemental/bad_response_not_native.json index c38bc9f69b9..1466737008f 100644 --- a/adapters/huaweiads/huaweiadstest/supplemental/bad_response_not_native.json +++ b/adapters/huaweiads/huaweiadstest/supplemental/bad_response_not_native.json @@ -93,9 +93,7 @@ "test": 1, "detailedCreativeTypeList": [ "903" - ], - "h": 200, - "w": 200 + ] } ], "device": {