forked from mxmCherry/openrtb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
device.go
277 lines (244 loc) · 6.73 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
package openrtb
import "encoding/json"
// 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:
// ua
// Type:
// string; recommended
// Description:
// Browser user agent string.
UA string `json:"ua,omitempty"`
// 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:
// 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 5.21.
DeviceType 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 uint64 `json:"h,omitempty"`
// Attribute:
// w
// Type:
// integer
// Description:
// Physical width of the screen in pixels.
W uint64 `json:"w,omitempty"`
// Attribute:
// ppi
// Type:
// integer
// Description:
// Screen size as pixels per linear inch.
PPI uint64 `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.
Language string `json:"language,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.
MCCMNC string `json:"mccmnc,omitempty"`
// Attribute:
// connectiontype
// Type:
// integer
// Description:
// Network connection type. Refer to List 5.22.
ConnectionType *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
// Description:
// Hardware device ID (e.g., IMEI); hashed via SHA1.
DIDSHA1 string `json:"didsha1,omitempty"`
// Attribute:
// didmd5
// Type:
// string
// Description:
// Hardware device ID (e.g., IMEI); hashed via MD5.
DIDMD5 string `json:"didmd5,omitempty"`
// Attribute:
// dpidsha1
// Type:
// string
// Description:
// Platform device ID (e.g., Android ID); hashed via SHA1.
DPIDSHA1 string `json:"dpidsha1,omitempty"`
// Attribute:
// dpidmd5
// Type:
// string
// Description:
// Platform device ID (e.g., Android ID); hashed via MD5.
DPIDMD5 string `json:"dpidmd5,omitempty"`
// Attribute:
// macsha1
// Type:
// string
// Description:
// MAC address of the device; hashed via SHA1.
MACSHA1 string `json:"macsha1,omitempty"`
// Attribute:
// macmd5
// Type:
// string
// 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"`
}