Skip to content

Commit 12c76e8

Browse files
authored
Merge pull request bsm#92 from stokito/add_sua
Add device.sua
2 parents 6f64bb3 + ac42b90 commit 12c76e8

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

device.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import "encoding/json"
77
// set top box or other digital device.
88
type Device struct {
99
UA string `json:"ua,omitempty"` // User agent
10+
Sua *UserAgent `json:"sua,omitempty"` // Structured User agent. It's more accurate than UA
1011
Geo *Geo `json:"geo,omitempty"` // Location of the device assumed to be the user’s current location
1112
DNT int `json:"dnt,omitempty"` // "1": Do not track
1213
LMT int `json:"lmt,omitempty"` // "1": Limit Ad Tracking

sua.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package openrtb
2+
3+
import "encoding/json"
4+
5+
type UserAgent struct {
6+
Browsers BrandVersion `json:"browsers,omitempty"` // A browser or similar software component
7+
Platform BrandVersion `json:"platform,omitempty"` // The user agent’s execution platform / OS
8+
Mobile int `json:"mobile,omitempty"` // 1 if the agent prefers a "mobile" version of the content, if available, i.e. optimized for small screens or touch input. 0 if the agent prefers the "desktop". Taken from Sec-CH-UAMobile header
9+
Architecture string `json:"architecture,omitempty"` // Device’s major binary architecture, e.g. "x86" or "arm". Taken from the Sec-CH-UA-Arch header
10+
Bitness string `json:"bitness,omitempty"` // Device’s bitness, e.g. "64" for 64-bit architecture. Taken from the Sec-CH-UA-Bitness header
11+
Model string `json:"model,omitempty"` // Device model. Taken from the Sec-CH-UAModel header
12+
Source string `json:"source,omitempty"` // The source of data used to create this object, List: User-Agent Source in AdCOM 1.0
13+
Ext json.RawMessage `json:"ext,omitempty"`
14+
}
15+
16+
type BrandVersion struct {
17+
Brand string `json:"brand,omitempty"` // A brand identifier, for example, "Chrome" or "Windows". Taken from the Sec-CH-UA-Full-Version or Sec-CH-UA-Platform header
18+
Version []string `json:"version,omitempty"` // A sequence of version components, in descending hierarchical order (major, minor, patch)
19+
Ext json.RawMessage `json:"ext,omitempty"`
20+
}

0 commit comments

Comments
 (0)