forked from PubMatic-OpenWrap/prebid-openrtb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
device.go
326 lines (290 loc) · 8.74 KB
/
device.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
package openrtb2
import (
"encoding/json"
"github.com/prebid/openrtb/v17/adcom1"
)
// 3.2.18 Object: Device
//
// This object provides information pertaining to the device through which the user is interacting.
// Device information includes its hardware, platform, location, and carrier data.
// The device can refer to a mobile handset, a desktop computer, set top box, or other digital device.
//
// BEST PRACTICE: There are currently no prominent open source lists for device makes, models, operating systems, or carriers.
// Exchanges typically use commercial products or other proprietary lists for these attributes.
// Until suitable open standards are available, exchanges are highly encouraged to publish lists of their device make, model, operating system, and carrier values to bidders.
//
// BEST PRACTICE: Proper device IP detection in mobile is not straightforward.
// Typically it involves starting at the left of the x-forwarded-for header, skipping private carrier networks (e.g., 10.x.x.x or 192.x.x.x), and possibly scanning for known carrier IP ranges.
// Exchanges are urged to research and implement this feature carefully when presenting device IP values to bidders.
type Device struct {
// Attribute:
// geo
// Type:
// object; recommended
// Description:
// Location of the device assumed to be the user’s current
// location defined by a Geo object (Section 3.2.19).
Geo *Geo `json:"geo,omitempty"`
// Attribute:
// dnt
// Type:
// integer; recommended
// Description:
// Standard “Do Not Track” flag as set in the header by the
// browser, where 0 = tracking is unrestricted, 1 = do not track.
DNT *int8 `json:"dnt,omitempty"`
// Attribute:
// lmt
// Type:
// integer; recommended
// Description:
// “Limit Ad Tracking” signal commercially endorsed (e.g., iOS,
// Android), where 0 = tracking is unrestricted, 1 = tracking must
// be limited per commercial guidelines.
Lmt *int8 `json:"lmt,omitempty"`
// Attribute:
// ua
// Type:
// string
// Description:
// Browser user agent string. This field represents a raw user
// agent string from the browser. For backwards compatibility,
// exchanges are recommended to always populate ‘ua’ with the
// User-Agent string, when available from the end user’s device,
// even if an alternative representation, such as the User-Agent
// Client-Hints, is available and is used to populate ‘sua’. No
// inferred or approximated user agents are expected in this field.
// If a client supports User-Agent Client Hints, and ‘sua’ field is
// present, bidders are recommended to rely on ‘sua’ for
// detecting device type, browser type and version and other
// purposes that rely on the user agent information, and ignore
// ‘ua’ field. This is because the ‘ua’ may contain a frozen or
// reduced user agent string.
UA string `json:"ua,omitempty"`
// Attribute:
// sua
// Type:
// object
// Description:
// Structured user agent information defined by a UserAgent
// object (see Section 3.2.29). If both ‘ua’ and ‘sua’ are present in
// the bid request, ‘sua’ should be considered the more accurate
// representation of the device attributes. This is because the ‘ua’
// may contain a frozen or reduced user agent string.
SUA *UserAgent `json:"sua,omitempty"`
// Attribute:
// ip
// Type:
// string; recommended
// Description:
// IPv4 address closest to device.
IP string `json:"ip,omitempty"`
// Attribute:
// ipv6
// Type:
// string
// Description:
// IP address closest to device as IPv6.
IPv6 string `json:"ipv6,omitempty"`
// Attribute:
// devicetype
// Type:
// integer
// Description:
// The general type of device. Refer to List: Device Types in
// AdCOM 1.0.
// Note:
// OpenRTB <=2.5 defined only types 1..7.
DeviceType adcom1.DeviceType `json:"devicetype,omitempty"`
// Attribute:
// make
// Type:
// string
// Description:
// Device make (e.g., “Apple”).
Make string `json:"make,omitempty"`
// Attribute:
// model
// Type:
// string
// Description:
// Device model (e.g., “iPhone”).
Model string `json:"model,omitempty"`
// Attribute:
// os
// Type:
// string
// Description:
// Device operating system (e.g., “iOS”).
OS string `json:"os,omitempty"`
// Attribute:
// osv
// Type:
// string
// Description:
// Device operating system version (e.g., “3.1.2”).
OSV string `json:"osv,omitempty"`
// Attribute:
// hwv
// Type:
// string
// Description:
// Hardware version of the device (e.g., “5S” for iPhone 5S).
HWV string `json:"hwv,omitempty"`
// Attribute:
// h
// Type:
// integer
// Description:
// Physical height of the screen in pixels.
H int64 `json:"h,omitempty"`
// Attribute:
// w
// Type:
// integer
// Description:
// Physical width of the screen in pixels.
W int64 `json:"w,omitempty"`
// Attribute:
// ppi
// Type:
// integer
// Description:
// Screen size as pixels per linear inch.
PPI int64 `json:"ppi,omitempty"`
// Attribute:
// pxratio
// Type:
// float
// Description:
// The ratio of physical pixels to device independent pixels.
PxRatio float64 `json:"pxratio,omitempty"`
// Attribute:
// js
// Type:
// integer
// Description:
// Support for JavaScript, where 0 = no, 1 = yes.
JS int8 `json:"js,omitempty"`
// Attribute:
// geofetch
// Type:
// integer
// Description:
// Indicates if the geolocation API will be available to JavaScript
// code running in the banner, where 0 = no, 1 = yes.
GeoFetch int8 `json:"geofetch,omitempty"`
// Attribute:
// flashver
// Type:
// string
// Description:
// Version of Flash supported by the browser.
FlashVer string `json:"flashver,omitempty"`
// Attribute:
// language
// Type:
// string
// Description:
// Browser language using ISO-639-1-alpha-2. Only one of
// language or langb should be present.
Language string `json:"language,omitempty"`
// Attribute:
// langb
// Type:
// string
// Description:
// Content language using IETF BCP 47. Only one of language or
// langb should be present.
LangB string `json:"langb,omitempty"`
// Attribute:
// carrier
// Type:
// string
// Description:
// Carrier or ISP (e.g., “VERIZON”) using exchange curated string
// names which should be published to bidders a priori.
Carrier string `json:"carrier,omitempty"`
// Attribute:
// mccmnc
// Type:
// string
// Description:
// Mobile carrier as the concatenated MCC-MNC code
// (e.g., "310-005" identifies Verizon Wireless CDMA in the
// USA).
// Refer to https://en.wikipedia.org/wiki/Mobile_country_code
// for further examples. Note that the dash between the MCC
// and MNC parts is required to remove parsing ambiguity. The
// MCC-MNC values represent the SIM installed on the device
// and do not change when a device is roaming. Roaming may
// be inferred by a combination of the MCC-MNC, geo, IP and
// other data signals.
MCCMNC string `json:"mccmnc,omitempty"`
// Attribute:
// connectiontype
// Type:
// integer
// Description:
// Network connection type. Refer to List: Connection Types in
// AdCOM 1.0.
// Note:
// OpenRTB <=2.5 defined only connection types 1..6.
ConnectionType *adcom1.ConnectionType `json:"connectiontype,omitempty"`
// Attribute:
// ifa
// Type:
// string
// Description:
// ID sanctioned for advertiser use in the clear (i.e., not hashed).
IFA string `json:"ifa,omitempty"`
// Attribute:
// didsha1
// Type:
// string; DEPRECATED
// Description:
// Hardware device ID (e.g., IMEI); hashed via SHA1.
DIDSHA1 string `json:"didsha1,omitempty"`
// Attribute:
// didmd5
// Type:
// string; DEPRECATED
// Description:
// Hardware device ID (e.g., IMEI); hashed via MD5.
DIDMD5 string `json:"didmd5,omitempty"`
// Attribute:
// dpidsha1
// Type:
// string; DEPRECATED
// Description:
// Platform device ID (e.g., Android ID); hashed via SHA1.
DPIDSHA1 string `json:"dpidsha1,omitempty"`
// Attribute:
// dpidmd5
// Type:
// string; DEPRECATED
// Description:
// Platform device ID (e.g., Android ID); hashed via MD5.
DPIDMD5 string `json:"dpidmd5,omitempty"`
// Attribute:
// macsha1
// Type:
// string; DEPRECATED
// Description:
// MAC address of the device; hashed via SHA1.
MACSHA1 string `json:"macsha1,omitempty"`
// Attribute:
// macmd5
// Type:
// string; DEPRECATED
// Description:
// MAC address of the device; hashed via MD5.
MACMD5 string `json:"macmd5,omitempty"`
// Attribute:
// ext
// Type:
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext json.RawMessage `json:"ext,omitempty"`
}