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

Huawei Ads: fix cta text empty and fill rate issue #3067

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 10 additions & 3 deletions adapters/huaweiads/huaweiads.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@
"detailedCreativeTypeList": [
"903"
],
"h": 200,
"test": 1,
"w": 200
"test": 1
}
],
"device": {
Expand Down Expand Up @@ -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": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@
"detailedCreativeTypeList": [
"901"
],
"h": 200,
"test": 1,
"w": 200
"test": 1
}
],
"device": {
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@
"detailedCreativeTypeList": [
"904"
],
"h": 200,
"test": 1,
"w": 200
"test": 1
}
],
"device": {
Expand Down Expand Up @@ -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": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@
"detailedCreativeTypeList": [
"904"
],
"h": 200,
"test": 1,
"w": 200
"test": 1
}
],
"device": {
Expand Down Expand Up @@ -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": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@
"test": 1,
"detailedCreativeTypeList": [
"903"
],
"h": 200,
"w": 200
]
}
],
"device": {
Expand Down