forked from PubMatic-OpenWrap/prebid-openrtb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
geo.go
144 lines (127 loc) · 3.76 KB
/
geo.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
package openrtb2
import (
"encoding/json"
"github.com/prebid/openrtb/v17/adcom1"
)
// 3.2.19 Object: Geo
//
// This object encapsulates various methods for specifying a geographic location.
// When subordinate to a
// Device object, it indicates the location of the device which can also be interpreted as the user’s current location.
// When subordinate to a User object, it indicates the location of the user’s home base (i.e., not necessarily their current location).
//
// The lat/lon attributes should only be passed if they conform to the accuracy depicted in the type attribute.
// For example, the centroid of a geographic region such as postal code should not be passed.
type Geo struct {
// Attribute:
// lat
// Type:
// float
// Description:
// Latitude from -90.0 to +90.0, where negative is south.
Lat float64 `json:"lat,omitempty"`
// Attribute:
// lon
// Type:
// float
// Description:
// Longitude from -180.0 to +180.0, where negative is west.
Lon float64 `json:"lon,omitempty"`
// Attribute:
// type
// Type:
// integer
// Description:
// Source of location data; recommended when passing
// lat/lon. Refer to List: Location Types in AdCOM 1.0.
Type adcom1.LocationType `json:"type,omitempty"`
// Attribute:
// accuracy
// Type:
// integer
// Description:
// Estimated location accuracy in meters; recommended when
// lat/lon are specified and derived from a device’s location
// services (i.e., type = 1). Note that this is the accuracy as
// reported from the device. Consult OS specific documentation
// (e.g., Android, iOS) for exact interpretation.
Accuracy int64 `json:"accuracy,omitempty"`
// Attribute:
// lastfix
// Type:
// integer
// Description:
// Number of seconds since this geolocation fix was established.
// Note that devices may cache location data across multiple
// fetches. Ideally, this value should be from the time the actual
// fix was taken.
LastFix int64 `json:"lastfix,omitempty"`
// Attribute:
// ipservice
// Type:
// integer
// Description:
// Service or provider used to determine geolocation from IP
// address if applicable (i.e., type = 2). Refer to List: IP
// Location Services in AdCOM 1.0.
IPService adcom1.IPLocationService `json:"ipservice,omitempty"`
// Attribute:
// country
// Type:
// string
// Description:
// Country code using ISO-3166-1-alpha-3.
Country string `json:"country,omitempty"`
// Attribute:
// region
// Type:
// string
// Description:
// Region code using ISO-3166-2; 2-letter state code if USA.
Region string `json:"region,omitempty"`
// Attribute:
// regionfips104
// Type:
// string
// Description:
// Region of a country using FIPS 10-4 notation. While OpenRTB
// supports this attribute, it has been withdrawn by NIST in 2008.
RegionFIPS104 string `json:"regionfips104,omitempty"`
// Attribute:
// metro
// Type:
// string
// Description:
// Google metro code; similar to but not exactly Nielsen DMAs.
// See Appendix A for a link to the codes.
Metro string `json:"metro,omitempty"`
// Attribute:
// city
// Type:
// string
// Description:
// City using United Nations Code for Trade & Transport
// Locations. See Appendix A for a link to the codes.
City string `json:"city,omitempty"`
// Attribute:
// zip
// Type:
// string
// Description:
// Zip or postal code.
ZIP string `json:"zip,omitempty"`
// Attribute:
// utcoffset
// Type:
// integer
// Description:
// Local time as the number +/- of minutes from UTC.
UTCOffset int64 `json:"utcoffset,omitempty"`
// Attribute:
// ext
// Type:
// object
// Description:
// Placeholder for exchange-specific extensions to OpenRTB.
Ext json.RawMessage `json:"ext,omitempty"`
}