Giter Site home page Giter Site logo

openrtb's People

Contributors

aaronreboot avatar bx2 avatar codenaugh avatar dim avatar dolzenko avatar emaraschio avatar gippe avatar iamtomcat avatar iand avatar justuswilhelm avatar katsukiniwa avatar marklr avatar masatoraatarashi avatar mxmcherry avatar ollevche avatar pd-pranay avatar pirsquare avatar ryanslade avatar saifat29 avatar sgodart avatar shivakumarss avatar sky-zeng avatar sondinhinfectious avatar stokito avatar teixeiratho avatar venediktov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openrtb's Issues

OpenRTB 2.6 |

OpenRTB 2.6 is released and includes features to support CTV buying and selling. Following are the updates :

  • New attributes and guides for buying and selling Ad Pods
  • New objects to describe Channel & Network of content
  • Structured User-Agent object to support upcoming freezes to User-Agent string
  • Use of AdCOM 1.0 Lists for faster updates

Reference: https://iabtechlab.com/wp-content/uploads/2022/04/OpenRTB-2-6_FINAL.pdf

Is there any plan to support these fields of 2.6.

Native request parsing on different field name.

Hello guys,

I have a requirement where the native bid request is present in another field. following is my impression json.

{
  "imp": [
    {
      "id": "1",
      "tagid": "12345",
      "secure": 0,
      "native": {
        "requestobj": {
          "layout": 2,
          "assets": [
            {
              "id": 1,
              "required": 1,
              "img": {
                "type": 1,
                "wmin": 64,
                "hmin": 64,
                "mimes": []
              }
            },
            {
              "id": 2,
              "required": 0,
              "data": {
                "type": 2,
                "len": 40
              }
            }
          ]
        },
        "api": [],
        "ver": "1"
      },
      "instl": 0
    }
  ]
}

I tried to modify https://github.com/bsm/openrtb/blob/master/native.go with following snippet

package openrtb

import (
	"github.com/bsm/openrtb/native/request"
)

// This object represents a native type impression. Native ad units are intended to blend seamlessly into
// the surrounding content (e.g., a sponsored Twitter or Facebook post). As such, the response must be
// well-structured to afford the publisher fine-grained control over rendering.
// The presence of a Native as a subordinate of the Imp object indicates that this impression is offered as
// a native type impression. At the publisher’s discretion, that same impression may also be offered as
// banner and/or video by also including as Imp subordinates the Banner and/or Video objects,
// respectively. However, any given bid for the impression must conform to one of the offered types.
type Native struct {
	Request    Extension       `json:"request"`         // Request payload complying with the Native Ad Specification.
	Ver        string          `json:"ver,omitempty"`   // Version of the Native Ad Specification to which request complies; highly recommended for efficient parsing.
	API        []int           `json:"api,omitempty"`   // List of supported API frameworks for this impression.
	BAttr      []int           `json:"battr,omitempty"` // Blocked creative attributes
	Ext        Extension       `json:"ext,omitempty"`
	NativeJSON request.Request `json:"requestobj,omitempty"` // Native Json Object.
}

but no luck it gives me a compilation error, stating


can't load package: import cycle not allowed
package github.com/bsm/openrtb
	imports github.com/bsm/openrtb/native/request
	imports github.com/bsm/openrtb

Can anyone of you guys help me out here, how do we handle this case. ?

Thanks
Shiva

Unmarshalling Native Response from Bid.AdMarkup fails because of presence of parent "native" object.

Native Ad Response is as follows -

{
  "id": "D64s_873",
  "bidid": "7410cn73n0293stw",
  "seatbid": [
    {
      "bid": [
        {
          "id": "cabw74389b7947b48932",
          "impid": "1",
          "price": 0.28221,
          "nurl": "http://random.link/?action=nurlnative&auction=${AUCTION_PRICE}&uniq=v5v5576c5",
          "adm": "{\"native\":{\"assets\":[{\"id\":1,\"required\":0,\"img\":{\"url\":\"http://randomlink.one\",\"w\":300,\"h\":300}},{\"id\":2,\"required\":0,\"img\":{\"url\":\"http://randomlink.two\",\"w\":1200,\"h\":628}},{\"id\":3,\"required\":0,\"title\":{\"text\":\"You’re just a tap away\"}}],\"link\":{\"url\":\"http://somerandom.link/dasdasdad\"},\"imptrackers\":[\"http://anotherrandom.link/?action=lorem&ipsum=123\",\"http://andanotherrandom.link/?action=lorem&ipsum=321\"]}}",
          "adomain": [
            "loremipsum.com"
          ],
          "cat": [
            "IAB1",
            "IAB9"
          ],
          "attr": [],
          "adid": "cahw34987h34",
          "cid": "a9oxn84a983n4",
          "crid": "p8na038n4x9"
        }
      ],
      "seat": "429"
    }
  ],
  "cur": "USD"
}

I try to Unmarshal Native Ad Response (which is "adm") as follows -

var native response.Response
err := json.Unmarshal([]bytes(bidResponse.AdMarkup), &native)
if err != nil {
    return
}

This however fails as "adm" contains "native" as parent wrapper.
The only solution I see is trimming the "native" parent object from the "adm" string, this however doesn't appear to be the correct solution.

How is the Native Request/Response subpackage supposed to be used in such scenario?

Update -
Also Native Response fields like required which is inside Asset struct is omitted during json.Marshal if it has a zero value.

SUA Browsers type is invalid

I found minor bug on sua.

According to IAB reference, Browsers fileld of sua type is Array of BrandVersion, but current it is BrandVersion .

010

https://iabtechlab.com/wp-content/uploads/2022/04/OpenRTB-2-6_FINAL.pdf

Browsers BrandVersion `json:"browsers,omitempty"` // A browser or similar software component

I want to fix this bug, but I don't have authorization to this repository, so please fix someone else.

If I'm wrong in pointing this out, please ignore this issue and close.

Is it possible to process request that has a minor problem with JSON format?

I am developing a server in Golang that accepts openRTB requests. Some of the requests that our partners are sending to the server contain minor problems with JSON validity like a wrong type of hyphen ("user":{"customdata":"48474fea-0aa1-45e1-8817-c5070e27448b”}). This kind of problem leads to an error in decoding with json package and initializing a openrtb.BidRequest struct. Is there a way to ignore a field that is not valid but still extract correct information from a request?

Reading native request

What is the best way going about reading a native request? I was intending on Native being a string object, but it looks like it's set as an Extension and I see there are json marshal and unmarshal functions associated to it. I have this, but haven't yet tested it:

var native request.Request
nativeBytes, err := json.Marshal(imp.Native.Request)
if err != nil {
    return
}

err = json.Unmarshal(nativeBytes, &native)
if err != nil {
    return
}

Remove omitempty from "w" and "h" of Video object to support passing 0x0 for dynamic ad size

Many RTB exchanges expect width and height to be 0x0 for them to support dynamic ad sizes for Video ads.
If we can remove the omitempty tag from w and h for only the Video object the zero values would begin to pass.

type Video struct {
    Width      int     `json:"w,omitempty"`      // <-- Remove this omitempty
    Height     int     `json:"h,omitempty"`      // <-- Remove this omitempty
}

Let me know your thoughts.

GDPR wrong omitempty

GDPR int `json:"gdpr,omitempty" // Flag that indicates whether or not the request is subject to GDPR regulations 0 = No, 1 = Yes, omission indicates Unknown

But marshaller converts {gdpr: 0} into "{}" string. Thus should be:
GDPR int `json:"gdpr"

Guidance Adding Native Ad Request and Native Ad Response

What is your intention regarding http://www.iab.net/media/file/OpenRTB-Native-Ads-Specification-1_0-Final.pdf ?

Would an implementation be in scope of this package or should it be layered on top of it?

While taking a stab at providing the right structures for marshalling, I could only see re-use of the Video type, but MinDuration and MaxDuration are required instead of recommended in the OpenRTB Native Ads Specification.

At the moment I am leaning towards a subpackage "nativeads" importing "openrtb" and parsing the string in Native.Request there. That would allow matching Native.Ver with the ver field encoded the the structure in the request.

Another idea would be to provide a completely independent package and let the user of both packages do that.

Any recommendations?

Video sequence property

When you set video sequence to 0, it automatically sets it's value to 1 when is marshalled.

any plan for 3.0?

Hi there,

since openrtb 3.0 is out for a while, is there any plan for it?

thanks!

Example of parsing openRTB requests with the new API

Hello,
I updated the dependency for this library today and noticed that parsing the openRTB requests has changed. What is the new equivalent to this command:
req, err := openrtb.ParseRequest(r.Body)

Could you provide an example or point to documentation?

Validatiors not conforming to IAB specifications ?

Hello,

I think there are some contradictions with IAB OpenRTB specifications on validators:

For example, in IAB specifications, it seems that an imp object can contain a video object and/or a banner object.

The presence of a Videoas a subordinate ofthe Impobject indicates that this impression is offered as a video type impression. At the publisher’s discretion, that same impression may also be offered as banner, audio, and/or native by also including as Impsubordinates objects of those types. However, any given bid for the impression must conform to one of the offered types.

Source: https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-API-Specification-Version-2-5-FINAL.pdf

But here is the code of the validator:


func (imp *Impression) assetCount() int {
	n := 0
	if imp.Banner != nil {
		n++
	}
	if imp.Video != nil {
		n++
	}
	if imp.Native != nil {
		n++
	}
	return n
}

// Validate the `imp` object
func (imp *Impression) Validate() error {
	if imp.ID == "" {
		return ErrInvalidImpNoID
	}

	if count := imp.assetCount(); count > 1 {
		return ErrInvalidImpMultiAssets
	}

	if imp.Video != nil {
		if err := imp.Video.Validate(); err != nil {
			return err
		}
	}

	return nil
}

Is there any particular reason for that behavior ?

imp.Secure and Misbehaving SSPs

Hi,

I'm using the code in production and after seeing error rates go up post-integration with an SSP, I realized that they're sending auctions that specify the secure tag as a string rather than an int.

I've resorted to forking to repo and specifying it as a json.Number - is maintaining a local fork my only solution or perhaps I could submit a PR?

Thanks,

Video sequence

Since 2.6 it's deprecated
And should be 0 by default. (Now 1)

Native request on different json node.

Hi,

I have cloned bsm/openrtb to suit my requirement mentioned here in this ticket #62

  • Now I am upgrading the bsm/openrtb version. to 3.x
  • Now since i am upgrading to bsm/openrtb 3.x i am thinking it there any way i can achieve this without cloning / modifying the source code ?

Thanks a lot.

Version to use bsm/openrtb | openRTB specification

I have been using this api for quiet a long time, i have forked this binaries in my repo ( reason for doing it was to customise a little )

  • Now i am planning to re-write my apis with go modules using the latest 1.4.11 of go.
  • I see there has been a change in bsm/openrtb v3.0.2 for instance earlier i was consuming impression object as request.Imp[] and now its been changed to request.Impressions[].
  • After migrating my go code to mod, it shows github.com/bsm/openrtb v2.1.2+incompatible

I have 2 questions wrt to versions :

  • Can i use the the latest version of bsm/openrtb v3.0.2 and include in go.mod as github.com/bsm/openrtb/v3 v3.0.2 for consumption of openRTB 2.2 - 2.5 requests or do i need to downgrade from v3.0.2 to 2.x version of bsm/openrtb ?
  • Another question i have is, bsm/openrtb v3.0.2supports openRTB spec 3.x requests ?

Thanks a lot.

prebid/openrtb

The very popular prebid-server uses own DTOs https://github.com/prebid/openrtb
They are support v2.6 fields and v3.0 and overall seems like more fields are supported. But from the other side there is no many enums like ContentCategory that the library have.
Maybe you can merge this two projects?

SUA source type is invalid

According to IAB reference, Source fileld of sua type is integer, but current it is string.

スクリーンショット 2023-02-09 19 41 48

https://github.com/InteractiveAdvertisingBureau/AdCOM/blob/master/AdCOM%20v1.0%20FINAL.md#object--useragent-

openrtb/sua.go

Line 12 in 56ba587

Source string `json:"source,omitempty"` // The source of data used to create this object, List: User-Agent Source in AdCOM 1.0

This causes the following error when decoding json

Unmarshal type error: expected=string, got=number, field=device.sua.source, offset=1282

Banner struck is improperly using the omitempty tag for the Pos field

Pos int `json:"pos,omitempty"` // Ad Position

At line 20 in banner.go:

Pos int `json:"pos,omitempty"`

The omitempty tag is causing the field to be omitted when the value is 0. However, according to the OpenRTB spec, a value of 0 is valid for the pos field:
https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-API-Specification-Version-2-5-FINAL.pdf

A potential fix would be to use an int pointer, which would change the value required to omit the field from 0 to nil.

Pos *int `json:"pos,omitempty"`

can't install

Hi guys,

go get github.com/bsm/openrtb/v3 brings:
cannot find package "github.com/bsm/openrtb/v3" in any of:
C:\Program Files\Go\src\github.com\bsm\openrtb\v3 (from $GOROOT)
C:\Users\s_vla\go\src\github.com\bsm\openrtb\v3 (from $GOPATH)

go version:
go version go1.20.4 windows/amd64

could you help? I use your regular github.com/bsm/openrtb but need to upgrade according latest rtb

Can we get a new release?

Hello, wondering if we could get a new release cut to the go package repository? We would like to take advantage of some of the new things, specifically Content Object additions (Network and Channel) as well as the Regulations updates.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.