1 // Copyright 2024 Google LLC. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Code generated file. DO NOT EDIT. 6 7 // Package analyticsreporting provides access to the Analytics Reporting API. 8 // 9 // For product documentation, see: https://developers.google.com/analytics/devguides/reporting/core/v4/ 10 // 11 // # Library status 12 // 13 // These client libraries are officially supported by Google. However, this 14 // library is considered complete and is in maintenance mode. This means 15 // that we will address critical bugs and security issues but will not add 16 // any new features. 17 // 18 // When possible, we recommend using our newer 19 // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go) 20 // that are still actively being worked and iterated on. 21 // 22 // # Creating a client 23 // 24 // Usage example: 25 // 26 // import "google.golang.org/api/analyticsreporting/v4" 27 // ... 28 // ctx := context.Background() 29 // analyticsreportingService, err := analyticsreporting.NewService(ctx) 30 // 31 // In this example, Google Application Default Credentials are used for 32 // authentication. For information on how to create and obtain Application 33 // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 34 // 35 // # Other authentication options 36 // 37 // By default, all available scopes (see "Constants") are used to authenticate. 38 // To restrict scopes, use [google.golang.org/api/option.WithScopes]: 39 // 40 // analyticsreportingService, err := analyticsreporting.NewService(ctx, option.WithScopes(analyticsreporting.AnalyticsReadonlyScope)) 41 // 42 // To use an API key for authentication (note: some APIs do not support API 43 // keys), use [google.golang.org/api/option.WithAPIKey]: 44 // 45 // analyticsreportingService, err := analyticsreporting.NewService(ctx, option.WithAPIKey("AIza...")) 46 // 47 // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth 48 // flow, use [google.golang.org/api/option.WithTokenSource]: 49 // 50 // config := &oauth2.Config{...} 51 // // ... 52 // token, err := config.Exchange(ctx, ...) 53 // analyticsreportingService, err := analyticsreporting.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 54 // 55 // See [google.golang.org/api/option.ClientOption] for details on options. 56 package analyticsreporting // import "google.golang.org/api/analyticsreporting/v4" 57 58 import ( 59 "bytes" 60 "context" 61 "encoding/json" 62 "errors" 63 "fmt" 64 "io" 65 "net/http" 66 "net/url" 67 "strconv" 68 "strings" 69 70 googleapi "google.golang.org/api/googleapi" 71 internal "google.golang.org/api/internal" 72 gensupport "google.golang.org/api/internal/gensupport" 73 option "google.golang.org/api/option" 74 internaloption "google.golang.org/api/option/internaloption" 75 htransport "google.golang.org/api/transport/http" 76 ) 77 78 // Always reference these packages, just in case the auto-generated code 79 // below doesn't. 80 var _ = bytes.NewBuffer 81 var _ = strconv.Itoa 82 var _ = fmt.Sprintf 83 var _ = json.NewDecoder 84 var _ = io.Copy 85 var _ = url.Parse 86 var _ = gensupport.MarshalJSON 87 var _ = googleapi.Version 88 var _ = errors.New 89 var _ = strings.Replace 90 var _ = context.Canceled 91 var _ = internaloption.WithDefaultEndpoint 92 var _ = internal.Version 93 94 const apiId = "analyticsreporting:v4" 95 const apiName = "analyticsreporting" 96 const apiVersion = "v4" 97 const basePath = "https://analyticsreporting.googleapis.com/" 98 const basePathTemplate = "https://analyticsreporting.UNIVERSE_DOMAIN/" 99 const mtlsBasePath = "https://analyticsreporting.mtls.googleapis.com/" 100 101 // OAuth2 scopes used by this API. 102 const ( 103 // View and manage your Google Analytics data 104 AnalyticsScope = "https://www.googleapis.com/auth/analytics" 105 106 // See and download your Google Analytics data 107 AnalyticsReadonlyScope = "https://www.googleapis.com/auth/analytics.readonly" 108 ) 109 110 // NewService creates a new Service. 111 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 112 scopesOption := internaloption.WithDefaultScopes( 113 "https://www.googleapis.com/auth/analytics", 114 "https://www.googleapis.com/auth/analytics.readonly", 115 ) 116 // NOTE: prepend, so we don't override user-specified scopes. 117 opts = append([]option.ClientOption{scopesOption}, opts...) 118 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 119 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate)) 120 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) 121 opts = append(opts, internaloption.EnableNewAuthLibrary()) 122 client, endpoint, err := htransport.NewClient(ctx, opts...) 123 if err != nil { 124 return nil, err 125 } 126 s, err := New(client) 127 if err != nil { 128 return nil, err 129 } 130 if endpoint != "" { 131 s.BasePath = endpoint 132 } 133 return s, nil 134 } 135 136 // New creates a new Service. It uses the provided http.Client for requests. 137 // 138 // Deprecated: please use NewService instead. 139 // To provide a custom HTTP client, use option.WithHTTPClient. 140 // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 141 func New(client *http.Client) (*Service, error) { 142 if client == nil { 143 return nil, errors.New("client is nil") 144 } 145 s := &Service{client: client, BasePath: basePath} 146 s.Reports = NewReportsService(s) 147 s.UserActivity = NewUserActivityService(s) 148 return s, nil 149 } 150 151 type Service struct { 152 client *http.Client 153 BasePath string // API endpoint base URL 154 UserAgent string // optional additional User-Agent fragment 155 156 Reports *ReportsService 157 158 UserActivity *UserActivityService 159 } 160 161 func (s *Service) userAgent() string { 162 if s.UserAgent == "" { 163 return googleapi.UserAgent 164 } 165 return googleapi.UserAgent + " " + s.UserAgent 166 } 167 168 func NewReportsService(s *Service) *ReportsService { 169 rs := &ReportsService{s: s} 170 return rs 171 } 172 173 type ReportsService struct { 174 s *Service 175 } 176 177 func NewUserActivityService(s *Service) *UserActivityService { 178 rs := &UserActivityService{s: s} 179 return rs 180 } 181 182 type UserActivityService struct { 183 s *Service 184 } 185 186 // Activity: An Activity represents data for an activity of a user. Note that 187 // an Activity is different from a hit. A hit might result in multiple 188 // Activity's. For example, if a hit includes a transaction and a goal 189 // completion, there will be two Activity protos for this hit, one for 190 // ECOMMERCE and one for GOAL. Conversely, multiple hits can also construct one 191 // Activity. In classic e-commerce, data for one transaction might be sent 192 // through multiple hits. These hits will be merged into one ECOMMERCE 193 // Activity. 194 type Activity struct { 195 // ActivityTime: Timestamp of the activity. If activities for a visit cross 196 // midnight and occur in two separate dates, then two sessions (one per date) 197 // share the session identifier. For example, say session ID 113472 has 198 // activity within 2019-08-20, and session ID 243742 has activity within 199 // 2019-08-25 and 2019-08-26. Session ID 113472 is one session, and session ID 200 // 243742 is two sessions. 201 ActivityTime string `json:"activityTime,omitempty"` 202 // ActivityType: Type of this activity. 203 // 204 // Possible values: 205 // "ACTIVITY_TYPE_UNSPECIFIED" - ActivityType will never have this value in 206 // the response. Using this type in the request will result in an error. 207 // "PAGEVIEW" - Used when the activity resulted out of a visitor viewing a 208 // page. 209 // "SCREENVIEW" - Used when the activity resulted out of a visitor using an 210 // application on a mobile device. 211 // "GOAL" - Used to denote that a goal type activity. 212 // "ECOMMERCE" - An e-commerce transaction was performed by the visitor on 213 // the page. 214 // "EVENT" - Used when the activity is an event. 215 ActivityType string `json:"activityType,omitempty"` 216 // Appview: This will be set if `activity_type` equals `SCREEN_VIEW`. 217 Appview *ScreenviewData `json:"appview,omitempty"` 218 // Campaign: For manual campaign tracking, it is the value of the utm_campaign 219 // campaign tracking parameter. For AdWords autotagging, it is the name(s) of 220 // the online ad campaign(s) you use for the property. If you use neither, its 221 // value is (not set). 222 Campaign string `json:"campaign,omitempty"` 223 // ChannelGrouping: The Channel Group associated with an end user's session for 224 // this View (defined by the View's Channel Groupings). 225 ChannelGrouping string `json:"channelGrouping,omitempty"` 226 // CustomDimension: A list of all custom dimensions associated with this 227 // activity. 228 CustomDimension []*CustomDimension `json:"customDimension,omitempty"` 229 // Ecommerce: This will be set if `activity_type` equals `ECOMMERCE`. 230 Ecommerce *EcommerceData `json:"ecommerce,omitempty"` 231 // Event: This field contains all the details pertaining to an event and will 232 // be set if `activity_type` equals `EVENT`. 233 Event *EventData `json:"event,omitempty"` 234 // Goals: This field contains a list of all the goals that were reached in this 235 // activity when `activity_type` equals `GOAL`. 236 Goals *GoalSetData `json:"goals,omitempty"` 237 // Hostname: The hostname from which the tracking request was made. 238 Hostname string `json:"hostname,omitempty"` 239 // Keyword: For manual campaign tracking, it is the value of the utm_term 240 // campaign tracking parameter. For AdWords traffic, it contains the best 241 // matching targeting criteria. For the display network, where multiple 242 // targeting criteria could have caused the ad to show up, it returns the best 243 // matching targeting criteria as selected by Ads. This could be 244 // display_keyword, site placement, boomuserlist, user_interest, age, or 245 // gender. Otherwise its value is (not set). 246 Keyword string `json:"keyword,omitempty"` 247 // LandingPagePath: The first page in users' sessions, or the landing page. 248 LandingPagePath string `json:"landingPagePath,omitempty"` 249 // Medium: The type of referrals. For manual campaign tracking, it is the value 250 // of the utm_medium campaign tracking parameter. For AdWords autotagging, it 251 // is cpc. If users came from a search engine detected by Google Analytics, it 252 // is organic. If the referrer is not a search engine, it is referral. If users 253 // came directly to the property and document.referrer is empty, its value is 254 // (none). 255 Medium string `json:"medium,omitempty"` 256 // Pageview: This will be set if `activity_type` equals `PAGEVIEW`. This field 257 // contains all the details about the visitor and the page that was visited. 258 Pageview *PageviewData `json:"pageview,omitempty"` 259 // Source: The source of referrals. For manual campaign tracking, it is the 260 // value of the utm_source campaign tracking parameter. For AdWords 261 // autotagging, it is google. If you use neither, it is the domain of the 262 // source (e.g., document.referrer) referring the users. It may also contain a 263 // port address. If users arrived without a referrer, its value is (direct). 264 Source string `json:"source,omitempty"` 265 // ForceSendFields is a list of field names (e.g. "ActivityTime") to 266 // unconditionally include in API requests. By default, fields with empty or 267 // default values are omitted from API requests. See 268 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 269 // details. 270 ForceSendFields []string `json:"-"` 271 // NullFields is a list of field names (e.g. "ActivityTime") to include in API 272 // requests with the JSON null value. By default, fields with empty values are 273 // omitted from API requests. See 274 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 275 NullFields []string `json:"-"` 276 } 277 278 func (s *Activity) MarshalJSON() ([]byte, error) { 279 type NoMethod Activity 280 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 281 } 282 283 // Cohort: Defines a cohort. A cohort is a group of users who share a common 284 // characteristic. For example, all users with the same acquisition date belong 285 // to the same cohort. 286 type Cohort struct { 287 // DateRange: This is used for `FIRST_VISIT_DATE` cohort, the cohort selects 288 // users whose first visit date is between start date and end date defined in 289 // the DateRange. The date ranges should be aligned for cohort requests. If the 290 // request contains `ga:cohortNthDay` it should be exactly one day long, if 291 // `ga:cohortNthWeek` it should be aligned to the week boundary (starting at 292 // Sunday and ending Saturday), and for `ga:cohortNthMonth` the date range 293 // should be aligned to the month (starting at the first and ending on the last 294 // day of the month). For LTV requests there are no such restrictions. You do 295 // not need to supply a date range for the `reportsRequest.dateRanges` field. 296 DateRange *DateRange `json:"dateRange,omitempty"` 297 // Name: A unique name for the cohort. If not defined name will be 298 // auto-generated with values cohort_[1234...]. 299 Name string `json:"name,omitempty"` 300 // Type: Type of the cohort. The only supported type as of now is 301 // `FIRST_VISIT_DATE`. If this field is unspecified the cohort is treated as 302 // `FIRST_VISIT_DATE` type cohort. 303 // 304 // Possible values: 305 // "UNSPECIFIED_COHORT_TYPE" - If unspecified it's treated as 306 // `FIRST_VISIT_DATE`. 307 // "FIRST_VISIT_DATE" - Cohorts that are selected based on first visit date. 308 Type string `json:"type,omitempty"` 309 // ForceSendFields is a list of field names (e.g. "DateRange") to 310 // unconditionally include in API requests. By default, fields with empty or 311 // default values are omitted from API requests. See 312 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 313 // details. 314 ForceSendFields []string `json:"-"` 315 // NullFields is a list of field names (e.g. "DateRange") to include in API 316 // requests with the JSON null value. By default, fields with empty values are 317 // omitted from API requests. See 318 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 319 NullFields []string `json:"-"` 320 } 321 322 func (s *Cohort) MarshalJSON() ([]byte, error) { 323 type NoMethod Cohort 324 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 325 } 326 327 // CohortGroup: Defines a cohort group. For example: "cohortGroup": { 328 // "cohorts": [{ "name": "cohort 1", "type": "FIRST_VISIT_DATE", "dateRange": { 329 // "startDate": "2015-08-01", "endDate": "2015-08-01" } },{ "name": "cohort 2" 330 // "type": "FIRST_VISIT_DATE" "dateRange": { "startDate": "2015-07-01", 331 // "endDate": "2015-07-01" } }] } 332 type CohortGroup struct { 333 // Cohorts: The definition for the cohort. 334 Cohorts []*Cohort `json:"cohorts,omitempty"` 335 // LifetimeValue: Enable Life Time Value (LTV). LTV measures lifetime value for 336 // users acquired through different channels. Please see: Cohort Analysis 337 // (https://support.google.com/analytics/answer/6074676) and Lifetime Value 338 // (https://support.google.com/analytics/answer/6182550) If the value of 339 // lifetimeValue is false: - The metric values are similar to the values in the 340 // web interface cohort report. - The cohort definition date ranges must be 341 // aligned to the calendar week and month. i.e. while requesting 342 // `ga:cohortNthWeek` the `startDate` in the cohort definition should be a 343 // Sunday and the `endDate` should be the following Saturday, and for 344 // `ga:cohortNthMonth`, the `startDate` should be the 1st of the month and 345 // `endDate` should be the last day of the month. When the lifetimeValue is 346 // true: - The metric values will correspond to the values in the web interface 347 // LifeTime value report. - The Lifetime Value report shows you how user value 348 // (Revenue) and engagement (Appviews, Goal Completions, Sessions, and Session 349 // Duration) grow during the 90 days after a user is acquired. - The metrics 350 // are calculated as a cumulative average per user per the time increment. - 351 // The cohort definition date ranges need not be aligned to the calendar week 352 // and month boundaries. - The `viewId` must be an app view ID 353 // (https://support.google.com/analytics/answer/2649553#WebVersusAppViews) 354 LifetimeValue bool `json:"lifetimeValue,omitempty"` 355 // ForceSendFields is a list of field names (e.g. "Cohorts") to unconditionally 356 // include in API requests. By default, fields with empty or default values are 357 // omitted from API requests. See 358 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 359 // details. 360 ForceSendFields []string `json:"-"` 361 // NullFields is a list of field names (e.g. "Cohorts") to include in API 362 // requests with the JSON null value. By default, fields with empty values are 363 // omitted from API requests. See 364 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 365 NullFields []string `json:"-"` 366 } 367 368 func (s *CohortGroup) MarshalJSON() ([]byte, error) { 369 type NoMethod CohortGroup 370 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 371 } 372 373 // ColumnHeader: Column headers. 374 type ColumnHeader struct { 375 // Dimensions: The dimension names in the response. 376 Dimensions []string `json:"dimensions,omitempty"` 377 // MetricHeader: Metric headers for the metrics in the response. 378 MetricHeader *MetricHeader `json:"metricHeader,omitempty"` 379 // ForceSendFields is a list of field names (e.g. "Dimensions") to 380 // unconditionally include in API requests. By default, fields with empty or 381 // default values are omitted from API requests. See 382 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 383 // details. 384 ForceSendFields []string `json:"-"` 385 // NullFields is a list of field names (e.g. "Dimensions") to include in API 386 // requests with the JSON null value. By default, fields with empty values are 387 // omitted from API requests. See 388 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 389 NullFields []string `json:"-"` 390 } 391 392 func (s *ColumnHeader) MarshalJSON() ([]byte, error) { 393 type NoMethod ColumnHeader 394 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 395 } 396 397 // CustomDimension: Custom dimension. 398 type CustomDimension struct { 399 // Index: Slot number of custom dimension. 400 Index int64 `json:"index,omitempty"` 401 // Value: Value of the custom dimension. Default value (i.e. empty string) 402 // indicates clearing sesion/visitor scope custom dimension value. 403 Value string `json:"value,omitempty"` 404 // ForceSendFields is a list of field names (e.g. "Index") to unconditionally 405 // include in API requests. By default, fields with empty or default values are 406 // omitted from API requests. See 407 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 408 // details. 409 ForceSendFields []string `json:"-"` 410 // NullFields is a list of field names (e.g. "Index") to include in API 411 // requests with the JSON null value. By default, fields with empty values are 412 // omitted from API requests. See 413 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 414 NullFields []string `json:"-"` 415 } 416 417 func (s *CustomDimension) MarshalJSON() ([]byte, error) { 418 type NoMethod CustomDimension 419 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 420 } 421 422 // DateRange: A contiguous set of days: startDate, startDate + 1 day, ..., 423 // endDate. The start and end dates are specified in ISO8601 424 // (https://en.wikipedia.org/wiki/ISO_8601) date format `YYYY-MM-DD`. 425 type DateRange struct { 426 // EndDate: The end date for the query in the format `YYYY-MM-DD`. 427 EndDate string `json:"endDate,omitempty"` 428 // StartDate: The start date for the query in the format `YYYY-MM-DD`. 429 StartDate string `json:"startDate,omitempty"` 430 // ForceSendFields is a list of field names (e.g. "EndDate") to unconditionally 431 // include in API requests. By default, fields with empty or default values are 432 // omitted from API requests. See 433 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 434 // details. 435 ForceSendFields []string `json:"-"` 436 // NullFields is a list of field names (e.g. "EndDate") to include in API 437 // requests with the JSON null value. By default, fields with empty values are 438 // omitted from API requests. See 439 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 440 NullFields []string `json:"-"` 441 } 442 443 func (s *DateRange) MarshalJSON() ([]byte, error) { 444 type NoMethod DateRange 445 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 446 } 447 448 // DateRangeValues: Used to return a list of metrics for a single DateRange / 449 // dimension combination 450 type DateRangeValues struct { 451 // PivotValueRegions: The values of each pivot region. 452 PivotValueRegions []*PivotValueRegion `json:"pivotValueRegions,omitempty"` 453 // Values: Each value corresponds to each Metric in the request. 454 Values []string `json:"values,omitempty"` 455 // ForceSendFields is a list of field names (e.g. "PivotValueRegions") to 456 // unconditionally include in API requests. By default, fields with empty or 457 // default values are omitted from API requests. See 458 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 459 // details. 460 ForceSendFields []string `json:"-"` 461 // NullFields is a list of field names (e.g. "PivotValueRegions") to include in 462 // API requests with the JSON null value. By default, fields with empty values 463 // are omitted from API requests. See 464 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 465 NullFields []string `json:"-"` 466 } 467 468 func (s *DateRangeValues) MarshalJSON() ([]byte, error) { 469 type NoMethod DateRangeValues 470 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 471 } 472 473 // Dimension: Dimensions (https://support.google.com/analytics/answer/1033861) 474 // are attributes of your data. For example, the dimension `ga:city` indicates 475 // the city, for example, "Paris" or "New York", from which a session 476 // originates. 477 type Dimension struct { 478 // HistogramBuckets: If non-empty, we place dimension values into buckets after 479 // string to int64. Dimension values that are not the string representation of 480 // an integral value will be converted to zero. The bucket values have to be in 481 // increasing order. Each bucket is closed on the lower end, and open on the 482 // upper end. The "first" bucket includes all values less than the first 483 // boundary, the "last" bucket includes all values up to infinity. Dimension 484 // values that fall in a bucket get transformed to a new dimension value. For 485 // example, if one gives a list of "0, 1, 3, 4, 7", then we return the 486 // following buckets: - bucket #1: values < 0, dimension value "<0" - bucket 487 // #2: values in [0,1), dimension value "0" - bucket #3: values in [1,3), 488 // dimension value "1-2" - bucket #4: values in [3,4), dimension value "3" - 489 // bucket #5: values in [4,7), dimension value "4-6" - bucket #6: values >= 7, 490 // dimension value "7+" NOTE: If you are applying histogram mutation on any 491 // dimension, and using that dimension in sort, you will want to use the sort 492 // type `HISTOGRAM_BUCKET` for that purpose. Without that the dimension values 493 // will be sorted according to dictionary (lexicographic) order. For example 494 // the ascending dictionary order is: "<50", "1001+", "121-1000", "50-120" And 495 // the ascending `HISTOGRAM_BUCKET` order is: "<50", "50-120", "121-1000", 496 // "1001+" The client has to explicitly request "orderType": 497 // "HISTOGRAM_BUCKET" for a histogram-mutated dimension. 498 HistogramBuckets googleapi.Int64s `json:"histogramBuckets,omitempty"` 499 // Name: Name of the dimension to fetch, for example `ga:browser`. 500 Name string `json:"name,omitempty"` 501 // ForceSendFields is a list of field names (e.g. "HistogramBuckets") to 502 // unconditionally include in API requests. By default, fields with empty or 503 // default values are omitted from API requests. See 504 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 505 // details. 506 ForceSendFields []string `json:"-"` 507 // NullFields is a list of field names (e.g. "HistogramBuckets") to include in 508 // API requests with the JSON null value. By default, fields with empty values 509 // are omitted from API requests. See 510 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 511 NullFields []string `json:"-"` 512 } 513 514 func (s *Dimension) MarshalJSON() ([]byte, error) { 515 type NoMethod Dimension 516 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 517 } 518 519 // DimensionFilter: Dimension filter specifies the filtering options on a 520 // dimension. 521 type DimensionFilter struct { 522 // CaseSensitive: Should the match be case sensitive? Default is false. 523 CaseSensitive bool `json:"caseSensitive,omitempty"` 524 // DimensionName: The dimension to filter on. A DimensionFilter must contain a 525 // dimension. 526 DimensionName string `json:"dimensionName,omitempty"` 527 // Expressions: Strings or regular expression to match against. Only the first 528 // value of the list is used for comparison unless the operator is `IN_LIST`. 529 // If `IN_LIST` operator, then the entire list is used to filter the dimensions 530 // as explained in the description of the `IN_LIST` operator. 531 Expressions []string `json:"expressions,omitempty"` 532 // Not: Logical `NOT` operator. If this boolean is set to true, then the 533 // matching dimension values will be excluded in the report. The default is 534 // false. 535 Not bool `json:"not,omitempty"` 536 // Operator: How to match the dimension to the expression. The default is 537 // REGEXP. 538 // 539 // Possible values: 540 // "OPERATOR_UNSPECIFIED" - If the match type is unspecified, it is treated 541 // as a `REGEXP`. 542 // "REGEXP" - The match expression is treated as a regular expression. All 543 // match types are not treated as regular expressions. 544 // "BEGINS_WITH" - Matches the value which begin with the match expression 545 // provided. 546 // "ENDS_WITH" - Matches the values which end with the match expression 547 // provided. 548 // "PARTIAL" - Substring match. 549 // "EXACT" - The value should match the match expression entirely. 550 // "NUMERIC_EQUAL" - Integer comparison filters. case sensitivity is ignored 551 // for these and the expression is assumed to be a string representing an 552 // integer. Failure conditions: - If expression is not a valid int64, the 553 // client should expect an error. - Input dimensions that are not valid int64 554 // values will never match the filter. 555 // "NUMERIC_GREATER_THAN" - Checks if the dimension is numerically greater 556 // than the match expression. Read the description for `NUMERIC_EQUALS` for 557 // restrictions. 558 // "NUMERIC_LESS_THAN" - Checks if the dimension is numerically less than the 559 // match expression. Read the description for `NUMERIC_EQUALS` for 560 // restrictions. 561 // "IN_LIST" - This option is used to specify a dimension filter whose 562 // expression can take any value from a selected list of values. This helps 563 // avoiding evaluating multiple exact match dimension filters which are OR'ed 564 // for every single response row. For example: expressions: ["A", "B", "C"] Any 565 // response row whose dimension has it is value as A, B or C, matches this 566 // DimensionFilter. 567 Operator string `json:"operator,omitempty"` 568 // ForceSendFields is a list of field names (e.g. "CaseSensitive") to 569 // unconditionally include in API requests. By default, fields with empty or 570 // default values are omitted from API requests. See 571 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 572 // details. 573 ForceSendFields []string `json:"-"` 574 // NullFields is a list of field names (e.g. "CaseSensitive") to include in API 575 // requests with the JSON null value. By default, fields with empty values are 576 // omitted from API requests. See 577 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 578 NullFields []string `json:"-"` 579 } 580 581 func (s *DimensionFilter) MarshalJSON() ([]byte, error) { 582 type NoMethod DimensionFilter 583 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 584 } 585 586 // DimensionFilterClause: A group of dimension filters. Set the operator value 587 // to specify how the filters are logically combined. 588 type DimensionFilterClause struct { 589 // Filters: The repeated set of filters. They are logically combined based on 590 // the operator specified. 591 Filters []*DimensionFilter `json:"filters,omitempty"` 592 // Operator: The operator for combining multiple dimension filters. If 593 // unspecified, it is treated as an `OR`. 594 // 595 // Possible values: 596 // "OPERATOR_UNSPECIFIED" - Unspecified operator. It is treated as an `OR`. 597 // "OR" - The logical `OR` operator. 598 // "AND" - The logical `AND` operator. 599 Operator string `json:"operator,omitempty"` 600 // ForceSendFields is a list of field names (e.g. "Filters") to unconditionally 601 // include in API requests. By default, fields with empty or default values are 602 // omitted from API requests. See 603 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 604 // details. 605 ForceSendFields []string `json:"-"` 606 // NullFields is a list of field names (e.g. "Filters") to include in API 607 // requests with the JSON null value. By default, fields with empty values are 608 // omitted from API requests. See 609 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 610 NullFields []string `json:"-"` 611 } 612 613 func (s *DimensionFilterClause) MarshalJSON() ([]byte, error) { 614 type NoMethod DimensionFilterClause 615 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 616 } 617 618 // DynamicSegment: Dynamic segment definition for defining the segment within 619 // the request. A segment can select users, sessions or both. 620 type DynamicSegment struct { 621 // Name: The name of the dynamic segment. 622 Name string `json:"name,omitempty"` 623 // SessionSegment: Session Segment to select sessions to include in the 624 // segment. 625 SessionSegment *SegmentDefinition `json:"sessionSegment,omitempty"` 626 // UserSegment: User Segment to select users to include in the segment. 627 UserSegment *SegmentDefinition `json:"userSegment,omitempty"` 628 // ForceSendFields is a list of field names (e.g. "Name") to unconditionally 629 // include in API requests. By default, fields with empty or default values are 630 // omitted from API requests. See 631 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 632 // details. 633 ForceSendFields []string `json:"-"` 634 // NullFields is a list of field names (e.g. "Name") to include in API requests 635 // with the JSON null value. By default, fields with empty values are omitted 636 // from API requests. See 637 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 638 NullFields []string `json:"-"` 639 } 640 641 func (s *DynamicSegment) MarshalJSON() ([]byte, error) { 642 type NoMethod DynamicSegment 643 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 644 } 645 646 // EcommerceData: E-commerce details associated with the user activity. 647 type EcommerceData struct { 648 // ActionType: Action associated with this e-commerce action. 649 // 650 // Possible values: 651 // "UNKNOWN" - Action type is not known. 652 // "CLICK" - Click through of product lists. 653 // "DETAILS_VIEW" - Product detail views. 654 // "ADD_TO_CART" - Add product(s) to cart. 655 // "REMOVE_FROM_CART" - Remove product(s) from cart. 656 // "CHECKOUT" - Check out. 657 // "PAYMENT" - Completed purchase. 658 // "REFUND" - Refund of purchase. 659 // "CHECKOUT_OPTION" - Checkout options. 660 ActionType string `json:"actionType,omitempty"` 661 // EcommerceType: The type of this e-commerce activity. 662 // 663 // Possible values: 664 // "ECOMMERCE_TYPE_UNSPECIFIED" - Used when the e-commerce activity type is 665 // unspecified. 666 // "CLASSIC" - Used when activity has classic (non-enhanced) e-commerce 667 // information. 668 // "ENHANCED" - Used when activity has enhanced e-commerce information. 669 EcommerceType string `json:"ecommerceType,omitempty"` 670 // Products: Details of the products in this transaction. 671 Products []*ProductData `json:"products,omitempty"` 672 // Transaction: Transaction details of this e-commerce action. 673 Transaction *TransactionData `json:"transaction,omitempty"` 674 // ForceSendFields is a list of field names (e.g. "ActionType") to 675 // unconditionally include in API requests. By default, fields with empty or 676 // default values are omitted from API requests. See 677 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 678 // details. 679 ForceSendFields []string `json:"-"` 680 // NullFields is a list of field names (e.g. "ActionType") to include in API 681 // requests with the JSON null value. By default, fields with empty values are 682 // omitted from API requests. See 683 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 684 NullFields []string `json:"-"` 685 } 686 687 func (s *EcommerceData) MarshalJSON() ([]byte, error) { 688 type NoMethod EcommerceData 689 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 690 } 691 692 // EventData: Represents all the details pertaining to an event. 693 type EventData struct { 694 // EventAction: Type of interaction with the object. Eg: 'play'. 695 EventAction string `json:"eventAction,omitempty"` 696 // EventCategory: The object on the page that was interacted with. Eg: 'Video'. 697 EventCategory string `json:"eventCategory,omitempty"` 698 // EventCount: Number of such events in this activity. 699 EventCount int64 `json:"eventCount,omitempty,string"` 700 // EventLabel: Label attached with the event. 701 EventLabel string `json:"eventLabel,omitempty"` 702 // EventValue: Numeric value associated with the event. 703 EventValue int64 `json:"eventValue,omitempty,string"` 704 // ForceSendFields is a list of field names (e.g. "EventAction") to 705 // unconditionally include in API requests. By default, fields with empty or 706 // default values are omitted from API requests. See 707 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 708 // details. 709 ForceSendFields []string `json:"-"` 710 // NullFields is a list of field names (e.g. "EventAction") to include in API 711 // requests with the JSON null value. By default, fields with empty values are 712 // omitted from API requests. See 713 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 714 NullFields []string `json:"-"` 715 } 716 717 func (s *EventData) MarshalJSON() ([]byte, error) { 718 type NoMethod EventData 719 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 720 } 721 722 // GetReportsRequest: The batch request containing multiple report request. 723 type GetReportsRequest struct { 724 // ReportRequests: Requests, each request will have a separate response. There 725 // can be a maximum of 5 requests. All requests should have the same 726 // `dateRanges`, `viewId`, `segments`, `samplingLevel`, and `cohortGroup`. 727 ReportRequests []*ReportRequest `json:"reportRequests,omitempty"` 728 // UseResourceQuotas: Enables resource based quotas 729 // (/analytics/devguides/reporting/core/v4/limits-quotas#analytics_reporting_api 730 // _v4), (defaults to `False`). If this field is set to `True` the per view 731 // (profile) quotas are governed by the computational cost of the request. Note 732 // that using cost based quotas will higher enable sampling rates. (10 Million 733 // for `SMALL`, 100M for `LARGE`. See the limits and quotas documentation 734 // (/analytics/devguides/reporting/core/v4/limits-quotas#analytics_reporting_api 735 // _v4) for details. 736 UseResourceQuotas bool `json:"useResourceQuotas,omitempty"` 737 // ForceSendFields is a list of field names (e.g. "ReportRequests") to 738 // unconditionally include in API requests. By default, fields with empty or 739 // default values are omitted from API requests. See 740 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 741 // details. 742 ForceSendFields []string `json:"-"` 743 // NullFields is a list of field names (e.g. "ReportRequests") to include in 744 // API requests with the JSON null value. By default, fields with empty values 745 // are omitted from API requests. See 746 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 747 NullFields []string `json:"-"` 748 } 749 750 func (s *GetReportsRequest) MarshalJSON() ([]byte, error) { 751 type NoMethod GetReportsRequest 752 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 753 } 754 755 // GetReportsResponse: The main response class which holds the reports from the 756 // Reporting API `batchGet` call. 757 type GetReportsResponse struct { 758 // QueryCost: The amount of resource quota tokens deducted to execute the 759 // query. Includes all responses. 760 QueryCost int64 `json:"queryCost,omitempty"` 761 // Reports: Responses corresponding to each of the request. 762 Reports []*Report `json:"reports,omitempty"` 763 // ResourceQuotasRemaining: The amount of resource quota remaining for the 764 // property. 765 ResourceQuotasRemaining *ResourceQuotasRemaining `json:"resourceQuotasRemaining,omitempty"` 766 767 // ServerResponse contains the HTTP response code and headers from the server. 768 googleapi.ServerResponse `json:"-"` 769 // ForceSendFields is a list of field names (e.g. "QueryCost") to 770 // unconditionally include in API requests. By default, fields with empty or 771 // default values are omitted from API requests. See 772 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 773 // details. 774 ForceSendFields []string `json:"-"` 775 // NullFields is a list of field names (e.g. "QueryCost") to include in API 776 // requests with the JSON null value. By default, fields with empty values are 777 // omitted from API requests. See 778 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 779 NullFields []string `json:"-"` 780 } 781 782 func (s *GetReportsResponse) MarshalJSON() ([]byte, error) { 783 type NoMethod GetReportsResponse 784 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 785 } 786 787 // GoalData: Represents all the details pertaining to a goal. 788 type GoalData struct { 789 // GoalCompletionLocation: URL of the page where this goal was completed. 790 GoalCompletionLocation string `json:"goalCompletionLocation,omitempty"` 791 // GoalCompletions: Total number of goal completions in this activity. 792 GoalCompletions int64 `json:"goalCompletions,omitempty,string"` 793 // GoalIndex: This identifies the goal as configured for the profile. 794 GoalIndex int64 `json:"goalIndex,omitempty"` 795 // GoalName: Name of the goal. 796 GoalName string `json:"goalName,omitempty"` 797 // GoalPreviousStep1: URL of the page one step prior to the goal completion. 798 GoalPreviousStep1 string `json:"goalPreviousStep1,omitempty"` 799 // GoalPreviousStep2: URL of the page two steps prior to the goal completion. 800 GoalPreviousStep2 string `json:"goalPreviousStep2,omitempty"` 801 // GoalPreviousStep3: URL of the page three steps prior to the goal completion. 802 GoalPreviousStep3 string `json:"goalPreviousStep3,omitempty"` 803 // GoalValue: Value in this goal. 804 GoalValue float64 `json:"goalValue,omitempty"` 805 // ForceSendFields is a list of field names (e.g. "GoalCompletionLocation") to 806 // unconditionally include in API requests. By default, fields with empty or 807 // default values are omitted from API requests. See 808 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 809 // details. 810 ForceSendFields []string `json:"-"` 811 // NullFields is a list of field names (e.g. "GoalCompletionLocation") to 812 // include in API requests with the JSON null value. By default, fields with 813 // empty values are omitted from API requests. See 814 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 815 NullFields []string `json:"-"` 816 } 817 818 func (s *GoalData) MarshalJSON() ([]byte, error) { 819 type NoMethod GoalData 820 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 821 } 822 823 func (s *GoalData) UnmarshalJSON(data []byte) error { 824 type NoMethod GoalData 825 var s1 struct { 826 GoalValue gensupport.JSONFloat64 `json:"goalValue"` 827 *NoMethod 828 } 829 s1.NoMethod = (*NoMethod)(s) 830 if err := json.Unmarshal(data, &s1); err != nil { 831 return err 832 } 833 s.GoalValue = float64(s1.GoalValue) 834 return nil 835 } 836 837 // GoalSetData: Represents a set of goals that were reached in an activity. 838 type GoalSetData struct { 839 // Goals: All the goals that were reached in the current activity. 840 Goals []*GoalData `json:"goals,omitempty"` 841 // ForceSendFields is a list of field names (e.g. "Goals") to unconditionally 842 // include in API requests. By default, fields with empty or default values are 843 // omitted from API requests. See 844 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 845 // details. 846 ForceSendFields []string `json:"-"` 847 // NullFields is a list of field names (e.g. "Goals") to include in API 848 // requests with the JSON null value. By default, fields with empty values are 849 // omitted from API requests. See 850 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 851 NullFields []string `json:"-"` 852 } 853 854 func (s *GoalSetData) MarshalJSON() ([]byte, error) { 855 type NoMethod GoalSetData 856 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 857 } 858 859 // Metric: Metrics (https://support.google.com/analytics/answer/1033861) are 860 // the quantitative measurements. For example, the metric `ga:users` indicates 861 // the total number of users for the requested time period. 862 type Metric struct { 863 // Alias: An alias for the metric expression is an alternate name for the 864 // expression. The alias can be used for filtering and sorting. This field is 865 // optional and is useful if the expression is not a single metric but a 866 // complex expression which cannot be used in filtering and sorting. The alias 867 // is also used in the response column header. 868 Alias string `json:"alias,omitempty"` 869 // Expression: A metric expression in the request. An expression is constructed 870 // from one or more metrics and numbers. Accepted operators include: Plus (+), 871 // Minus (-), Negation (Unary -), Divided by (/), Multiplied by (*), 872 // Parenthesis, Positive cardinal numbers (0-9), can include decimals and is 873 // limited to 1024 characters. Example `ga:totalRefunds/ga:users`, in most 874 // cases the metric expression is just a single metric name like `ga:users`. 875 // Adding mixed `MetricType` (E.g., `CURRENCY` + `PERCENTAGE`) metrics will 876 // result in unexpected results. 877 Expression string `json:"expression,omitempty"` 878 // FormattingType: Specifies how the metric expression should be formatted, for 879 // example `INTEGER`. 880 // 881 // Possible values: 882 // "METRIC_TYPE_UNSPECIFIED" - Metric type is unspecified. 883 // "INTEGER" - Integer metric. 884 // "FLOAT" - Float metric. 885 // "CURRENCY" - Currency metric. 886 // "PERCENT" - Percentage metric. 887 // "TIME" - Time metric in `HH:MM:SS` format. 888 FormattingType string `json:"formattingType,omitempty"` 889 // ForceSendFields is a list of field names (e.g. "Alias") to unconditionally 890 // include in API requests. By default, fields with empty or default values are 891 // omitted from API requests. See 892 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 893 // details. 894 ForceSendFields []string `json:"-"` 895 // NullFields is a list of field names (e.g. "Alias") to include in API 896 // requests with the JSON null value. By default, fields with empty values are 897 // omitted from API requests. See 898 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 899 NullFields []string `json:"-"` 900 } 901 902 func (s *Metric) MarshalJSON() ([]byte, error) { 903 type NoMethod Metric 904 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 905 } 906 907 // MetricFilter: MetricFilter specifies the filter on a metric. 908 type MetricFilter struct { 909 // ComparisonValue: The value to compare against. 910 ComparisonValue string `json:"comparisonValue,omitempty"` 911 // MetricName: The metric that will be filtered on. A metricFilter must contain 912 // a metric name. A metric name can be an alias earlier defined as a metric or 913 // it can also be a metric expression. 914 MetricName string `json:"metricName,omitempty"` 915 // Not: Logical `NOT` operator. If this boolean is set to true, then the 916 // matching metric values will be excluded in the report. The default is false. 917 Not bool `json:"not,omitempty"` 918 // Operator: Is the metric `EQUAL`, `LESS_THAN` or `GREATER_THAN` the 919 // comparisonValue, the default is `EQUAL`. If the operator is `IS_MISSING`, 920 // checks if the metric is missing and would ignore the comparisonValue. 921 // 922 // Possible values: 923 // "OPERATOR_UNSPECIFIED" - If the operator is not specified, it is treated 924 // as `EQUAL`. 925 // "EQUAL" - Should the value of the metric be exactly equal to the 926 // comparison value. 927 // "LESS_THAN" - Should the value of the metric be less than to the 928 // comparison value. 929 // "GREATER_THAN" - Should the value of the metric be greater than to the 930 // comparison value. 931 // "IS_MISSING" - Validates if the metric is missing. Doesn't take 932 // comparisonValue into account. 933 Operator string `json:"operator,omitempty"` 934 // ForceSendFields is a list of field names (e.g. "ComparisonValue") to 935 // unconditionally include in API requests. By default, fields with empty or 936 // default values are omitted from API requests. See 937 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 938 // details. 939 ForceSendFields []string `json:"-"` 940 // NullFields is a list of field names (e.g. "ComparisonValue") to include in 941 // API requests with the JSON null value. By default, fields with empty values 942 // are omitted from API requests. See 943 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 944 NullFields []string `json:"-"` 945 } 946 947 func (s *MetricFilter) MarshalJSON() ([]byte, error) { 948 type NoMethod MetricFilter 949 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 950 } 951 952 // MetricFilterClause: Represents a group of metric filters. Set the operator 953 // value to specify how the filters are logically combined. 954 type MetricFilterClause struct { 955 // Filters: The repeated set of filters. They are logically combined based on 956 // the operator specified. 957 Filters []*MetricFilter `json:"filters,omitempty"` 958 // Operator: The operator for combining multiple metric filters. If 959 // unspecified, it is treated as an `OR`. 960 // 961 // Possible values: 962 // "OPERATOR_UNSPECIFIED" - Unspecified operator. It is treated as an `OR`. 963 // "OR" - The logical `OR` operator. 964 // "AND" - The logical `AND` operator. 965 Operator string `json:"operator,omitempty"` 966 // ForceSendFields is a list of field names (e.g. "Filters") to unconditionally 967 // include in API requests. By default, fields with empty or default values are 968 // omitted from API requests. See 969 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 970 // details. 971 ForceSendFields []string `json:"-"` 972 // NullFields is a list of field names (e.g. "Filters") to include in API 973 // requests with the JSON null value. By default, fields with empty values are 974 // omitted from API requests. See 975 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 976 NullFields []string `json:"-"` 977 } 978 979 func (s *MetricFilterClause) MarshalJSON() ([]byte, error) { 980 type NoMethod MetricFilterClause 981 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 982 } 983 984 // MetricHeader: The headers for the metrics. 985 type MetricHeader struct { 986 // MetricHeaderEntries: Headers for the metrics in the response. 987 MetricHeaderEntries []*MetricHeaderEntry `json:"metricHeaderEntries,omitempty"` 988 // PivotHeaders: Headers for the pivots in the response. 989 PivotHeaders []*PivotHeader `json:"pivotHeaders,omitempty"` 990 // ForceSendFields is a list of field names (e.g. "MetricHeaderEntries") to 991 // unconditionally include in API requests. By default, fields with empty or 992 // default values are omitted from API requests. See 993 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 994 // details. 995 ForceSendFields []string `json:"-"` 996 // NullFields is a list of field names (e.g. "MetricHeaderEntries") to include 997 // in API requests with the JSON null value. By default, fields with empty 998 // values are omitted from API requests. See 999 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1000 NullFields []string `json:"-"` 1001 } 1002 1003 func (s *MetricHeader) MarshalJSON() ([]byte, error) { 1004 type NoMethod MetricHeader 1005 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1006 } 1007 1008 // MetricHeaderEntry: Header for the metrics. 1009 type MetricHeaderEntry struct { 1010 // Name: The name of the header. 1011 Name string `json:"name,omitempty"` 1012 // Type: The type of the metric, for example `INTEGER`. 1013 // 1014 // Possible values: 1015 // "METRIC_TYPE_UNSPECIFIED" - Metric type is unspecified. 1016 // "INTEGER" - Integer metric. 1017 // "FLOAT" - Float metric. 1018 // "CURRENCY" - Currency metric. 1019 // "PERCENT" - Percentage metric. 1020 // "TIME" - Time metric in `HH:MM:SS` format. 1021 Type string `json:"type,omitempty"` 1022 // ForceSendFields is a list of field names (e.g. "Name") to unconditionally 1023 // include in API requests. By default, fields with empty or default values are 1024 // omitted from API requests. See 1025 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1026 // details. 1027 ForceSendFields []string `json:"-"` 1028 // NullFields is a list of field names (e.g. "Name") to include in API requests 1029 // with the JSON null value. By default, fields with empty values are omitted 1030 // from API requests. See 1031 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1032 NullFields []string `json:"-"` 1033 } 1034 1035 func (s *MetricHeaderEntry) MarshalJSON() ([]byte, error) { 1036 type NoMethod MetricHeaderEntry 1037 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1038 } 1039 1040 // OrFiltersForSegment: A list of segment filters in the `OR` group are 1041 // combined with the logical OR operator. 1042 type OrFiltersForSegment struct { 1043 // SegmentFilterClauses: List of segment filters to be combined with a `OR` 1044 // operator. 1045 SegmentFilterClauses []*SegmentFilterClause `json:"segmentFilterClauses,omitempty"` 1046 // ForceSendFields is a list of field names (e.g. "SegmentFilterClauses") to 1047 // unconditionally include in API requests. By default, fields with empty or 1048 // default values are omitted from API requests. See 1049 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1050 // details. 1051 ForceSendFields []string `json:"-"` 1052 // NullFields is a list of field names (e.g. "SegmentFilterClauses") to include 1053 // in API requests with the JSON null value. By default, fields with empty 1054 // values are omitted from API requests. See 1055 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1056 NullFields []string `json:"-"` 1057 } 1058 1059 func (s *OrFiltersForSegment) MarshalJSON() ([]byte, error) { 1060 type NoMethod OrFiltersForSegment 1061 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1062 } 1063 1064 // OrderBy: Specifies the sorting options. 1065 type OrderBy struct { 1066 // FieldName: The field which to sort by. The default sort order is ascending. 1067 // Example: `ga:browser`. Note, that you can only specify one field for sort 1068 // here. For example, `ga:browser, ga:city` is not valid. 1069 FieldName string `json:"fieldName,omitempty"` 1070 // OrderType: The order type. The default orderType is `VALUE`. 1071 // 1072 // Possible values: 1073 // "ORDER_TYPE_UNSPECIFIED" - Unspecified order type will be treated as sort 1074 // based on value. 1075 // "VALUE" - The sort order is based on the value of the chosen column; looks 1076 // only at the first date range. 1077 // "DELTA" - The sort order is based on the difference of the values of the 1078 // chosen column between the first two date ranges. Usable only if there are 1079 // exactly two date ranges. 1080 // "SMART" - The sort order is based on weighted value of the chosen column. 1081 // If column has n/d format, then weighted value of this ratio will be `(n + 1082 // totals.n)/(d + totals.d)` Usable only for metrics that represent ratios. 1083 // "HISTOGRAM_BUCKET" - Histogram order type is applicable only to dimension 1084 // columns with non-empty histogram-buckets. 1085 // "DIMENSION_AS_INTEGER" - If the dimensions are fixed length numbers, 1086 // ordinary sort would just work fine. `DIMENSION_AS_INTEGER` can be used if 1087 // the dimensions are variable length numbers. 1088 OrderType string `json:"orderType,omitempty"` 1089 // SortOrder: The sorting order for the field. 1090 // 1091 // Possible values: 1092 // "SORT_ORDER_UNSPECIFIED" - If the sort order is unspecified, the default 1093 // is ascending. 1094 // "ASCENDING" - Ascending sort. The field will be sorted in an ascending 1095 // manner. 1096 // "DESCENDING" - Descending sort. The field will be sorted in a descending 1097 // manner. 1098 SortOrder string `json:"sortOrder,omitempty"` 1099 // ForceSendFields is a list of field names (e.g. "FieldName") to 1100 // unconditionally include in API requests. By default, fields with empty or 1101 // default values are omitted from API requests. See 1102 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1103 // details. 1104 ForceSendFields []string `json:"-"` 1105 // NullFields is a list of field names (e.g. "FieldName") to include in API 1106 // requests with the JSON null value. By default, fields with empty values are 1107 // omitted from API requests. See 1108 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1109 NullFields []string `json:"-"` 1110 } 1111 1112 func (s *OrderBy) MarshalJSON() ([]byte, error) { 1113 type NoMethod OrderBy 1114 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1115 } 1116 1117 // PageviewData: Represents details collected when the visitor views a page. 1118 type PageviewData struct { 1119 // PagePath: The URL of the page that the visitor viewed. 1120 PagePath string `json:"pagePath,omitempty"` 1121 // PageTitle: The title of the page that the visitor viewed. 1122 PageTitle string `json:"pageTitle,omitempty"` 1123 // ForceSendFields is a list of field names (e.g. "PagePath") to 1124 // unconditionally include in API requests. By default, fields with empty or 1125 // default values are omitted from API requests. See 1126 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1127 // details. 1128 ForceSendFields []string `json:"-"` 1129 // NullFields is a list of field names (e.g. "PagePath") to include in API 1130 // requests with the JSON null value. By default, fields with empty values are 1131 // omitted from API requests. See 1132 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1133 NullFields []string `json:"-"` 1134 } 1135 1136 func (s *PageviewData) MarshalJSON() ([]byte, error) { 1137 type NoMethod PageviewData 1138 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1139 } 1140 1141 // Pivot: The Pivot describes the pivot section in the request. The Pivot helps 1142 // rearrange the information in the table for certain reports by pivoting your 1143 // data on a second dimension. 1144 type Pivot struct { 1145 // DimensionFilterClauses: DimensionFilterClauses are logically combined with 1146 // an `AND` operator: only data that is included by all these 1147 // DimensionFilterClauses contributes to the values in this pivot region. 1148 // Dimension filters can be used to restrict the columns shown in the pivot 1149 // region. For example if you have `ga:browser` as the requested dimension in 1150 // the pivot region, and you specify key filters to restrict `ga:browser` to 1151 // only "IE" or "Firefox", then only those two browsers would show up as 1152 // columns. 1153 DimensionFilterClauses []*DimensionFilterClause `json:"dimensionFilterClauses,omitempty"` 1154 // Dimensions: A list of dimensions to show as pivot columns. A Pivot can have 1155 // a maximum of 4 dimensions. Pivot dimensions are part of the restriction on 1156 // the total number of dimensions allowed in the request. 1157 Dimensions []*Dimension `json:"dimensions,omitempty"` 1158 // MaxGroupCount: Specifies the maximum number of groups to return. The default 1159 // value is 10, also the maximum value is 1,000. 1160 MaxGroupCount int64 `json:"maxGroupCount,omitempty"` 1161 // Metrics: The pivot metrics. Pivot metrics are part of the restriction on 1162 // total number of metrics allowed in the request. 1163 Metrics []*Metric `json:"metrics,omitempty"` 1164 // StartGroup: If k metrics were requested, then the response will contain some 1165 // data-dependent multiple of k columns in the report. E.g., if you pivoted on 1166 // the dimension `ga:browser` then you'd get k columns for "Firefox", k columns 1167 // for "IE", k columns for "Chrome", etc. The ordering of the groups of columns 1168 // is determined by descending order of "total" for the first of the k values. 1169 // Ties are broken by lexicographic ordering of the first pivot dimension, then 1170 // lexicographic ordering of the second pivot dimension, and so on. E.g., if 1171 // the totals for the first value for Firefox, IE, and Chrome were 8, 2, 8, 1172 // respectively, the order of columns would be Chrome, Firefox, IE. The 1173 // following let you choose which of the groups of k columns are included in 1174 // the response. 1175 StartGroup int64 `json:"startGroup,omitempty"` 1176 // ForceSendFields is a list of field names (e.g. "DimensionFilterClauses") to 1177 // unconditionally include in API requests. By default, fields with empty or 1178 // default values are omitted from API requests. See 1179 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1180 // details. 1181 ForceSendFields []string `json:"-"` 1182 // NullFields is a list of field names (e.g. "DimensionFilterClauses") to 1183 // include in API requests with the JSON null value. By default, fields with 1184 // empty values are omitted from API requests. See 1185 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1186 NullFields []string `json:"-"` 1187 } 1188 1189 func (s *Pivot) MarshalJSON() ([]byte, error) { 1190 type NoMethod Pivot 1191 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1192 } 1193 1194 // PivotHeader: The headers for each of the pivot sections defined in the 1195 // request. 1196 type PivotHeader struct { 1197 // PivotHeaderEntries: A single pivot section header. 1198 PivotHeaderEntries []*PivotHeaderEntry `json:"pivotHeaderEntries,omitempty"` 1199 // TotalPivotGroupsCount: The total number of groups for this pivot. 1200 TotalPivotGroupsCount int64 `json:"totalPivotGroupsCount,omitempty"` 1201 // ForceSendFields is a list of field names (e.g. "PivotHeaderEntries") to 1202 // unconditionally include in API requests. By default, fields with empty or 1203 // default values are omitted from API requests. See 1204 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1205 // details. 1206 ForceSendFields []string `json:"-"` 1207 // NullFields is a list of field names (e.g. "PivotHeaderEntries") to include 1208 // in API requests with the JSON null value. By default, fields with empty 1209 // values are omitted from API requests. See 1210 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1211 NullFields []string `json:"-"` 1212 } 1213 1214 func (s *PivotHeader) MarshalJSON() ([]byte, error) { 1215 type NoMethod PivotHeader 1216 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1217 } 1218 1219 // PivotHeaderEntry: The headers for the each of the metric column 1220 // corresponding to the metrics requested in the pivots section of the 1221 // response. 1222 type PivotHeaderEntry struct { 1223 // DimensionNames: The name of the dimensions in the pivot response. 1224 DimensionNames []string `json:"dimensionNames,omitempty"` 1225 // DimensionValues: The values for the dimensions in the pivot. 1226 DimensionValues []string `json:"dimensionValues,omitempty"` 1227 // Metric: The metric header for the metric in the pivot. 1228 Metric *MetricHeaderEntry `json:"metric,omitempty"` 1229 // ForceSendFields is a list of field names (e.g. "DimensionNames") to 1230 // unconditionally include in API requests. By default, fields with empty or 1231 // default values are omitted from API requests. See 1232 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1233 // details. 1234 ForceSendFields []string `json:"-"` 1235 // NullFields is a list of field names (e.g. "DimensionNames") to include in 1236 // API requests with the JSON null value. By default, fields with empty values 1237 // are omitted from API requests. See 1238 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1239 NullFields []string `json:"-"` 1240 } 1241 1242 func (s *PivotHeaderEntry) MarshalJSON() ([]byte, error) { 1243 type NoMethod PivotHeaderEntry 1244 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1245 } 1246 1247 // PivotValueRegion: The metric values in the pivot region. 1248 type PivotValueRegion struct { 1249 // Values: The values of the metrics in each of the pivot regions. 1250 Values []string `json:"values,omitempty"` 1251 // ForceSendFields is a list of field names (e.g. "Values") to unconditionally 1252 // include in API requests. By default, fields with empty or default values are 1253 // omitted from API requests. See 1254 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1255 // details. 1256 ForceSendFields []string `json:"-"` 1257 // NullFields is a list of field names (e.g. "Values") to include in API 1258 // requests with the JSON null value. By default, fields with empty values are 1259 // omitted from API requests. See 1260 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1261 NullFields []string `json:"-"` 1262 } 1263 1264 func (s *PivotValueRegion) MarshalJSON() ([]byte, error) { 1265 type NoMethod PivotValueRegion 1266 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1267 } 1268 1269 // ProductData: Details of the products in an e-commerce transaction. 1270 type ProductData struct { 1271 // ItemRevenue: The total revenue from purchased product items. 1272 ItemRevenue float64 `json:"itemRevenue,omitempty"` 1273 // ProductName: The product name, supplied by the e-commerce tracking 1274 // application, for the purchased items. 1275 ProductName string `json:"productName,omitempty"` 1276 // ProductQuantity: Total number of this product units in the transaction. 1277 ProductQuantity int64 `json:"productQuantity,omitempty,string"` 1278 // ProductSku: Unique code that represents the product. 1279 ProductSku string `json:"productSku,omitempty"` 1280 // ForceSendFields is a list of field names (e.g. "ItemRevenue") to 1281 // unconditionally include in API requests. By default, fields with empty or 1282 // default values are omitted from API requests. See 1283 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1284 // details. 1285 ForceSendFields []string `json:"-"` 1286 // NullFields is a list of field names (e.g. "ItemRevenue") to include in API 1287 // requests with the JSON null value. By default, fields with empty values are 1288 // omitted from API requests. See 1289 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1290 NullFields []string `json:"-"` 1291 } 1292 1293 func (s *ProductData) MarshalJSON() ([]byte, error) { 1294 type NoMethod ProductData 1295 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1296 } 1297 1298 func (s *ProductData) UnmarshalJSON(data []byte) error { 1299 type NoMethod ProductData 1300 var s1 struct { 1301 ItemRevenue gensupport.JSONFloat64 `json:"itemRevenue"` 1302 *NoMethod 1303 } 1304 s1.NoMethod = (*NoMethod)(s) 1305 if err := json.Unmarshal(data, &s1); err != nil { 1306 return err 1307 } 1308 s.ItemRevenue = float64(s1.ItemRevenue) 1309 return nil 1310 } 1311 1312 // Report: The data response corresponding to the request. 1313 type Report struct { 1314 // ColumnHeader: The column headers. 1315 ColumnHeader *ColumnHeader `json:"columnHeader,omitempty"` 1316 // Data: Response data. 1317 Data *ReportData `json:"data,omitempty"` 1318 // NextPageToken: Page token to retrieve the next page of results in the list. 1319 NextPageToken string `json:"nextPageToken,omitempty"` 1320 // ForceSendFields is a list of field names (e.g. "ColumnHeader") to 1321 // unconditionally include in API requests. By default, fields with empty or 1322 // default values are omitted from API requests. See 1323 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1324 // details. 1325 ForceSendFields []string `json:"-"` 1326 // NullFields is a list of field names (e.g. "ColumnHeader") to include in API 1327 // requests with the JSON null value. By default, fields with empty values are 1328 // omitted from API requests. See 1329 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1330 NullFields []string `json:"-"` 1331 } 1332 1333 func (s *Report) MarshalJSON() ([]byte, error) { 1334 type NoMethod Report 1335 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1336 } 1337 1338 // ReportData: The data part of the report. 1339 type ReportData struct { 1340 // DataLastRefreshed: The last time the data in the report was refreshed. All 1341 // the hits received before this timestamp are included in the calculation of 1342 // the report. 1343 DataLastRefreshed string `json:"dataLastRefreshed,omitempty"` 1344 // EmptyReason: If empty reason is specified, the report is empty for this 1345 // reason. 1346 EmptyReason string `json:"emptyReason,omitempty"` 1347 // IsDataGolden: Indicates if response to this request is golden or not. Data 1348 // is golden when the exact same request will not produce any new results if 1349 // asked at a later point in time. 1350 IsDataGolden bool `json:"isDataGolden,omitempty"` 1351 // Maximums: Minimum and maximum values seen over all matching rows. These are 1352 // both empty when `hideValueRanges` in the request is false, or when rowCount 1353 // is zero. 1354 Maximums []*DateRangeValues `json:"maximums,omitempty"` 1355 // Minimums: Minimum and maximum values seen over all matching rows. These are 1356 // both empty when `hideValueRanges` in the request is false, or when rowCount 1357 // is zero. 1358 Minimums []*DateRangeValues `json:"minimums,omitempty"` 1359 // RowCount: Total number of matching rows for this query. 1360 RowCount int64 `json:"rowCount,omitempty"` 1361 // Rows: There's one ReportRow for every unique combination of dimensions. 1362 Rows []*ReportRow `json:"rows,omitempty"` 1363 // SamplesReadCounts: If the results are sampled 1364 // (https://support.google.com/analytics/answer/2637192), this returns the 1365 // total number of samples read, one entry per date range. If the results are 1366 // not sampled this field will not be defined. See developer guide 1367 // (/analytics/devguides/reporting/core/v4/basics#sampling) for details. 1368 SamplesReadCounts googleapi.Int64s `json:"samplesReadCounts,omitempty"` 1369 // SamplingSpaceSizes: If the results are sampled 1370 // (https://support.google.com/analytics/answer/2637192), this returns the 1371 // total number of samples present, one entry per date range. If the results 1372 // are not sampled this field will not be defined. See developer guide 1373 // (/analytics/devguides/reporting/core/v4/basics#sampling) for details. 1374 SamplingSpaceSizes googleapi.Int64s `json:"samplingSpaceSizes,omitempty"` 1375 // Totals: For each requested date range, for the set of all rows that match 1376 // the query, every requested value format gets a total. The total for a value 1377 // format is computed by first totaling the metrics mentioned in the value 1378 // format and then evaluating the value format as a scalar expression. E.g., 1379 // The "totals" for `3 / (ga:sessions + 2)` we compute `3 / ((sum of all 1380 // relevant ga:sessions) + 2)`. Totals are computed before pagination. 1381 Totals []*DateRangeValues `json:"totals,omitempty"` 1382 // ForceSendFields is a list of field names (e.g. "DataLastRefreshed") to 1383 // unconditionally include in API requests. By default, fields with empty or 1384 // default values are omitted from API requests. See 1385 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1386 // details. 1387 ForceSendFields []string `json:"-"` 1388 // NullFields is a list of field names (e.g. "DataLastRefreshed") to include in 1389 // API requests with the JSON null value. By default, fields with empty values 1390 // are omitted from API requests. See 1391 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1392 NullFields []string `json:"-"` 1393 } 1394 1395 func (s *ReportData) MarshalJSON() ([]byte, error) { 1396 type NoMethod ReportData 1397 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1398 } 1399 1400 // ReportRequest: The main request class which specifies the Reporting API 1401 // request. 1402 type ReportRequest struct { 1403 // CohortGroup: Cohort group associated with this request. If there is a cohort 1404 // group in the request the `ga:cohort` dimension must be present. Every 1405 // ReportRequest (#ReportRequest) within a `batchGet` method must contain the 1406 // same `cohortGroup` definition. 1407 CohortGroup *CohortGroup `json:"cohortGroup,omitempty"` 1408 // DateRanges: Date ranges in the request. The request can have a maximum of 2 1409 // date ranges. The response will contain a set of metric values for each 1410 // combination of the dimensions for each date range in the request. So, if 1411 // there are two date ranges, there will be two set of metric values, one for 1412 // the original date range and one for the second date range. The 1413 // `reportRequest.dateRanges` field should not be specified for cohorts or 1414 // Lifetime value requests. If a date range is not provided, the default date 1415 // range is (startDate: current date - 7 days, endDate: current date - 1 day). 1416 // Every ReportRequest (#ReportRequest) within a `batchGet` method must contain 1417 // the same `dateRanges` definition. 1418 DateRanges []*DateRange `json:"dateRanges,omitempty"` 1419 // DimensionFilterClauses: The dimension filter clauses for filtering Dimension 1420 // Values. They are logically combined with the `AND` operator. Note that 1421 // filtering occurs before any dimensions are aggregated, so that the returned 1422 // metrics represent the total for only the relevant dimensions. 1423 DimensionFilterClauses []*DimensionFilterClause `json:"dimensionFilterClauses,omitempty"` 1424 // Dimensions: The dimensions requested. Requests can have a total of 9 1425 // dimensions. 1426 Dimensions []*Dimension `json:"dimensions,omitempty"` 1427 // FiltersExpression: Dimension or metric filters that restrict the data 1428 // returned for your request. To use the `filtersExpression`, supply a 1429 // dimension or metric on which to filter, followed by the filter expression. 1430 // For example, the following expression selects `ga:browser` dimension which 1431 // starts with Firefox; `ga:browser=~^Firefox`. For more information on 1432 // dimensions and metric filters, see Filters reference 1433 // (https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters). 1434 FiltersExpression string `json:"filtersExpression,omitempty"` 1435 // HideTotals: If set to true, hides the total of all metrics for all the 1436 // matching rows, for every date range. The default false and will return the 1437 // totals. 1438 HideTotals bool `json:"hideTotals,omitempty"` 1439 // HideValueRanges: If set to true, hides the minimum and maximum across all 1440 // matching rows. The default is false and the value ranges are returned. 1441 HideValueRanges bool `json:"hideValueRanges,omitempty"` 1442 // IncludeEmptyRows: If set to false, the response does not include rows if all 1443 // the retrieved metrics are equal to zero. The default is false which will 1444 // exclude these rows. 1445 IncludeEmptyRows bool `json:"includeEmptyRows,omitempty"` 1446 // MetricFilterClauses: The metric filter clauses. They are logically combined 1447 // with the `AND` operator. Metric filters look at only the first date range 1448 // and not the comparing date range. Note that filtering on metrics occurs 1449 // after the metrics are aggregated. 1450 MetricFilterClauses []*MetricFilterClause `json:"metricFilterClauses,omitempty"` 1451 // Metrics: The metrics requested. Requests must specify at least one metric. 1452 // Requests can have a total of 10 metrics. 1453 Metrics []*Metric `json:"metrics,omitempty"` 1454 // OrderBys: Sort order on output rows. To compare two rows, the elements of 1455 // the following are applied in order until a difference is found. All date 1456 // ranges in the output get the same row order. 1457 OrderBys []*OrderBy `json:"orderBys,omitempty"` 1458 // PageSize: Page size is for paging and specifies the maximum number of 1459 // returned rows. Page size should be >= 0. A query returns the default of 1460 // 1,000 rows. The Analytics Core Reporting API returns a maximum of 100,000 1461 // rows per request, no matter how many you ask for. It can also return fewer 1462 // rows than requested, if there aren't as many dimension segments as you 1463 // expect. For instance, there are fewer than 300 possible values for 1464 // `ga:country`, so when segmenting only by country, you can't get more than 1465 // 300 rows, even if you set `pageSize` to a higher value. 1466 PageSize int64 `json:"pageSize,omitempty"` 1467 // PageToken: A continuation token to get the next page of the results. Adding 1468 // this to the request will return the rows after the pageToken. The pageToken 1469 // should be the value returned in the nextPageToken parameter in the response 1470 // to the GetReports request. 1471 PageToken string `json:"pageToken,omitempty"` 1472 // Pivots: The pivot definitions. Requests can have a maximum of 2 pivots. 1473 Pivots []*Pivot `json:"pivots,omitempty"` 1474 // SamplingLevel: The desired report sample 1475 // (https://support.google.com/analytics/answer/2637192) size. If the the 1476 // `samplingLevel` field is unspecified the `DEFAULT` sampling level is used. 1477 // Every ReportRequest (#ReportRequest) within a `batchGet` method must contain 1478 // the same `samplingLevel` definition. See developer guide 1479 // (/analytics/devguides/reporting/core/v4/basics#sampling) for details. 1480 // 1481 // Possible values: 1482 // "SAMPLING_UNSPECIFIED" - If the `samplingLevel` field is unspecified the 1483 // `DEFAULT` sampling level is used. 1484 // "DEFAULT" - Returns response with a sample size that balances speed and 1485 // accuracy. 1486 // "SMALL" - It returns a fast response with a smaller sampling size. 1487 // "LARGE" - Returns a more accurate response using a large sampling size. 1488 // But this may result in response being slower. 1489 SamplingLevel string `json:"samplingLevel,omitempty"` 1490 // Segments: Segment the data returned for the request. A segment definition 1491 // helps look at a subset of the segment request. A request can contain up to 1492 // four segments. Every ReportRequest (#ReportRequest) within a `batchGet` 1493 // method must contain the same `segments` definition. Requests with segments 1494 // must have the `ga:segment` dimension. 1495 Segments []*Segment `json:"segments,omitempty"` 1496 // ViewId: The Analytics view ID 1497 // (https://support.google.com/analytics/answer/1009618) from which to retrieve 1498 // data. Every ReportRequest (#ReportRequest) within a `batchGet` method must 1499 // contain the same `viewId`. 1500 ViewId string `json:"viewId,omitempty"` 1501 // ForceSendFields is a list of field names (e.g. "CohortGroup") to 1502 // unconditionally include in API requests. By default, fields with empty or 1503 // default values are omitted from API requests. See 1504 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1505 // details. 1506 ForceSendFields []string `json:"-"` 1507 // NullFields is a list of field names (e.g. "CohortGroup") to include in API 1508 // requests with the JSON null value. By default, fields with empty values are 1509 // omitted from API requests. See 1510 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1511 NullFields []string `json:"-"` 1512 } 1513 1514 func (s *ReportRequest) MarshalJSON() ([]byte, error) { 1515 type NoMethod ReportRequest 1516 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1517 } 1518 1519 // ReportRow: A row in the report. 1520 type ReportRow struct { 1521 // Dimensions: List of requested dimensions. 1522 Dimensions []string `json:"dimensions,omitempty"` 1523 // Metrics: List of metrics for each requested DateRange. 1524 Metrics []*DateRangeValues `json:"metrics,omitempty"` 1525 // ForceSendFields is a list of field names (e.g. "Dimensions") to 1526 // unconditionally include in API requests. By default, fields with empty or 1527 // default values are omitted from API requests. See 1528 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1529 // details. 1530 ForceSendFields []string `json:"-"` 1531 // NullFields is a list of field names (e.g. "Dimensions") to include in API 1532 // requests with the JSON null value. By default, fields with empty values are 1533 // omitted from API requests. See 1534 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1535 NullFields []string `json:"-"` 1536 } 1537 1538 func (s *ReportRow) MarshalJSON() ([]byte, error) { 1539 type NoMethod ReportRow 1540 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1541 } 1542 1543 // ResourceQuotasRemaining: The resource quota tokens remaining for the 1544 // property after the request is completed. 1545 type ResourceQuotasRemaining struct { 1546 // DailyQuotaTokensRemaining: Daily resource quota remaining remaining. 1547 DailyQuotaTokensRemaining int64 `json:"dailyQuotaTokensRemaining,omitempty"` 1548 // HourlyQuotaTokensRemaining: Hourly resource quota tokens remaining. 1549 HourlyQuotaTokensRemaining int64 `json:"hourlyQuotaTokensRemaining,omitempty"` 1550 // ForceSendFields is a list of field names (e.g. "DailyQuotaTokensRemaining") 1551 // to unconditionally include in API requests. By default, fields with empty or 1552 // default values are omitted from API requests. See 1553 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1554 // details. 1555 ForceSendFields []string `json:"-"` 1556 // NullFields is a list of field names (e.g. "DailyQuotaTokensRemaining") to 1557 // include in API requests with the JSON null value. By default, fields with 1558 // empty values are omitted from API requests. See 1559 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1560 NullFields []string `json:"-"` 1561 } 1562 1563 func (s *ResourceQuotasRemaining) MarshalJSON() ([]byte, error) { 1564 type NoMethod ResourceQuotasRemaining 1565 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1566 } 1567 1568 type ScreenviewData struct { 1569 // AppName: The application name. 1570 AppName string `json:"appName,omitempty"` 1571 // MobileDeviceBranding: Mobile manufacturer or branded name. Eg: "Google", 1572 // "Apple" etc. 1573 MobileDeviceBranding string `json:"mobileDeviceBranding,omitempty"` 1574 // MobileDeviceModel: Mobile device model. Eg: "Pixel", "iPhone" etc. 1575 MobileDeviceModel string `json:"mobileDeviceModel,omitempty"` 1576 // ScreenName: The name of the screen. 1577 ScreenName string `json:"screenName,omitempty"` 1578 // ForceSendFields is a list of field names (e.g. "AppName") to unconditionally 1579 // include in API requests. By default, fields with empty or default values are 1580 // omitted from API requests. See 1581 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1582 // details. 1583 ForceSendFields []string `json:"-"` 1584 // NullFields is a list of field names (e.g. "AppName") to include in API 1585 // requests with the JSON null value. By default, fields with empty values are 1586 // omitted from API requests. See 1587 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1588 NullFields []string `json:"-"` 1589 } 1590 1591 func (s *ScreenviewData) MarshalJSON() ([]byte, error) { 1592 type NoMethod ScreenviewData 1593 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1594 } 1595 1596 // SearchUserActivityRequest: The request to fetch User Report from Reporting 1597 // API `userActivity:get` call. 1598 type SearchUserActivityRequest struct { 1599 // ActivityTypes: Set of all activity types being requested. Only acvities 1600 // matching these types will be returned in the response. If empty, all 1601 // activies will be returned. 1602 // 1603 // Possible values: 1604 // "ACTIVITY_TYPE_UNSPECIFIED" - ActivityType will never have this value in 1605 // the response. Using this type in the request will result in an error. 1606 // "PAGEVIEW" - Used when the activity resulted out of a visitor viewing a 1607 // page. 1608 // "SCREENVIEW" - Used when the activity resulted out of a visitor using an 1609 // application on a mobile device. 1610 // "GOAL" - Used to denote that a goal type activity. 1611 // "ECOMMERCE" - An e-commerce transaction was performed by the visitor on 1612 // the page. 1613 // "EVENT" - Used when the activity is an event. 1614 ActivityTypes []string `json:"activityTypes,omitempty"` 1615 // DateRange: Date range for which to retrieve the user activity. If a date 1616 // range is not provided, the default date range is (startDate: current date - 1617 // 7 days, endDate: current date - 1 day). 1618 DateRange *DateRange `json:"dateRange,omitempty"` 1619 // PageSize: Page size is for paging and specifies the maximum number of 1620 // returned rows. Page size should be > 0. If the value is 0 or if the field 1621 // isn't specified, the request returns the default of 1000 rows per page. 1622 PageSize int64 `json:"pageSize,omitempty"` 1623 // PageToken: A continuation token to get the next page of the results. Adding 1624 // this to the request will return the rows after the pageToken. The pageToken 1625 // should be the value returned in the nextPageToken parameter in the response 1626 // to the SearchUserActivityRequest (#SearchUserActivityRequest) request. 1627 PageToken string `json:"pageToken,omitempty"` 1628 // User: Required. Unique user Id to query for. Every SearchUserActivityRequest 1629 // (#SearchUserActivityRequest) must contain this field. 1630 User *User `json:"user,omitempty"` 1631 // ViewId: Required. The Analytics view ID 1632 // (https://support.google.com/analytics/answer/1009618) from which to retrieve 1633 // data. Every SearchUserActivityRequest (#SearchUserActivityRequest) must 1634 // contain the `viewId`. 1635 ViewId string `json:"viewId,omitempty"` 1636 // ForceSendFields is a list of field names (e.g. "ActivityTypes") to 1637 // unconditionally include in API requests. By default, fields with empty or 1638 // default values are omitted from API requests. See 1639 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1640 // details. 1641 ForceSendFields []string `json:"-"` 1642 // NullFields is a list of field names (e.g. "ActivityTypes") to include in API 1643 // requests with the JSON null value. By default, fields with empty values are 1644 // omitted from API requests. See 1645 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1646 NullFields []string `json:"-"` 1647 } 1648 1649 func (s *SearchUserActivityRequest) MarshalJSON() ([]byte, error) { 1650 type NoMethod SearchUserActivityRequest 1651 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1652 } 1653 1654 // SearchUserActivityResponse: The response from `userActivity:get` call. 1655 type SearchUserActivityResponse struct { 1656 // NextPageToken: This token should be passed to SearchUserActivityRequest 1657 // (#SearchUserActivityRequest) to retrieve the next page. 1658 NextPageToken string `json:"nextPageToken,omitempty"` 1659 // SampleRate: This field represents the sampling rate 1660 // (https://support.google.com/analytics/answer/2637192) for the given request 1661 // and is a number between 0.0 to 1.0. See developer guide 1662 // (/analytics/devguides/reporting/core/v4/basics#sampling) for details. 1663 SampleRate float64 `json:"sampleRate,omitempty"` 1664 // Sessions: Each record represents a session (device details, duration, etc). 1665 Sessions []*UserActivitySession `json:"sessions,omitempty"` 1666 // TotalRows: Total rows returned by this query (across different pages). 1667 TotalRows int64 `json:"totalRows,omitempty"` 1668 1669 // ServerResponse contains the HTTP response code and headers from the server. 1670 googleapi.ServerResponse `json:"-"` 1671 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 1672 // unconditionally include in API requests. By default, fields with empty or 1673 // default values are omitted from API requests. See 1674 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1675 // details. 1676 ForceSendFields []string `json:"-"` 1677 // NullFields is a list of field names (e.g. "NextPageToken") to include in API 1678 // requests with the JSON null value. By default, fields with empty values are 1679 // omitted from API requests. See 1680 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1681 NullFields []string `json:"-"` 1682 } 1683 1684 func (s *SearchUserActivityResponse) MarshalJSON() ([]byte, error) { 1685 type NoMethod SearchUserActivityResponse 1686 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1687 } 1688 1689 func (s *SearchUserActivityResponse) UnmarshalJSON(data []byte) error { 1690 type NoMethod SearchUserActivityResponse 1691 var s1 struct { 1692 SampleRate gensupport.JSONFloat64 `json:"sampleRate"` 1693 *NoMethod 1694 } 1695 s1.NoMethod = (*NoMethod)(s) 1696 if err := json.Unmarshal(data, &s1); err != nil { 1697 return err 1698 } 1699 s.SampleRate = float64(s1.SampleRate) 1700 return nil 1701 } 1702 1703 // Segment: The segment definition, if the report needs to be segmented. A 1704 // Segment is a subset of the Analytics data. For example, of the entire set of 1705 // users, one Segment might be users from a particular country or city. 1706 type Segment struct { 1707 // DynamicSegment: A dynamic segment definition in the request. 1708 DynamicSegment *DynamicSegment `json:"dynamicSegment,omitempty"` 1709 // SegmentId: The segment ID of a built-in or custom segment, for example 1710 // `gaid::-3`. 1711 SegmentId string `json:"segmentId,omitempty"` 1712 // ForceSendFields is a list of field names (e.g. "DynamicSegment") to 1713 // unconditionally include in API requests. By default, fields with empty or 1714 // default values are omitted from API requests. See 1715 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1716 // details. 1717 ForceSendFields []string `json:"-"` 1718 // NullFields is a list of field names (e.g. "DynamicSegment") to include in 1719 // API requests with the JSON null value. By default, fields with empty values 1720 // are omitted from API requests. See 1721 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1722 NullFields []string `json:"-"` 1723 } 1724 1725 func (s *Segment) MarshalJSON() ([]byte, error) { 1726 type NoMethod Segment 1727 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1728 } 1729 1730 // SegmentDefinition: SegmentDefinition defines the segment to be a set of 1731 // SegmentFilters which are combined together with a logical `AND` operation. 1732 type SegmentDefinition struct { 1733 // SegmentFilters: A segment is defined by a set of segment filters which are 1734 // combined together with a logical `AND` operation. 1735 SegmentFilters []*SegmentFilter `json:"segmentFilters,omitempty"` 1736 // ForceSendFields is a list of field names (e.g. "SegmentFilters") to 1737 // unconditionally include in API requests. By default, fields with empty or 1738 // default values are omitted from API requests. See 1739 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1740 // details. 1741 ForceSendFields []string `json:"-"` 1742 // NullFields is a list of field names (e.g. "SegmentFilters") to include in 1743 // API requests with the JSON null value. By default, fields with empty values 1744 // are omitted from API requests. See 1745 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1746 NullFields []string `json:"-"` 1747 } 1748 1749 func (s *SegmentDefinition) MarshalJSON() ([]byte, error) { 1750 type NoMethod SegmentDefinition 1751 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1752 } 1753 1754 // SegmentDimensionFilter: Dimension filter specifies the filtering options on 1755 // a dimension. 1756 type SegmentDimensionFilter struct { 1757 // CaseSensitive: Should the match be case sensitive, ignored for `IN_LIST` 1758 // operator. 1759 CaseSensitive bool `json:"caseSensitive,omitempty"` 1760 // DimensionName: Name of the dimension for which the filter is being applied. 1761 DimensionName string `json:"dimensionName,omitempty"` 1762 // Expressions: The list of expressions, only the first element is used for all 1763 // operators 1764 Expressions []string `json:"expressions,omitempty"` 1765 // MaxComparisonValue: Maximum comparison values for `BETWEEN` match type. 1766 MaxComparisonValue string `json:"maxComparisonValue,omitempty"` 1767 // MinComparisonValue: Minimum comparison values for `BETWEEN` match type. 1768 MinComparisonValue string `json:"minComparisonValue,omitempty"` 1769 // Operator: The operator to use to match the dimension with the expressions. 1770 // 1771 // Possible values: 1772 // "OPERATOR_UNSPECIFIED" - If the match type is unspecified, it is treated 1773 // as a REGEXP. 1774 // "REGEXP" - The match expression is treated as a regular expression. All 1775 // other match types are not treated as regular expressions. 1776 // "BEGINS_WITH" - Matches the values which begin with the match expression 1777 // provided. 1778 // "ENDS_WITH" - Matches the values which end with the match expression 1779 // provided. 1780 // "PARTIAL" - Substring match. 1781 // "EXACT" - The value should match the match expression entirely. 1782 // "IN_LIST" - This option is used to specify a dimension filter whose 1783 // expression can take any value from a selected list of values. This helps 1784 // avoiding evaluating multiple exact match dimension filters which are OR'ed 1785 // for every single response row. For example: expressions: ["A", "B", "C"] Any 1786 // response row whose dimension has it is value as A, B or C, matches this 1787 // DimensionFilter. 1788 // "NUMERIC_LESS_THAN" - Integer comparison filters. case sensitivity is 1789 // ignored for these and the expression is assumed to be a string representing 1790 // an integer. Failure conditions: - if expression is not a valid int64, the 1791 // client should expect an error. - input dimensions that are not valid int64 1792 // values will never match the filter. Checks if the dimension is numerically 1793 // less than the match expression. 1794 // "NUMERIC_GREATER_THAN" - Checks if the dimension is numerically greater 1795 // than the match expression. 1796 // "NUMERIC_BETWEEN" - Checks if the dimension is numerically between the 1797 // minimum and maximum of the match expression, boundaries excluded. 1798 Operator string `json:"operator,omitempty"` 1799 // ForceSendFields is a list of field names (e.g. "CaseSensitive") to 1800 // unconditionally include in API requests. By default, fields with empty or 1801 // default values are omitted from API requests. See 1802 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1803 // details. 1804 ForceSendFields []string `json:"-"` 1805 // NullFields is a list of field names (e.g. "CaseSensitive") to include in API 1806 // requests with the JSON null value. By default, fields with empty values are 1807 // omitted from API requests. See 1808 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1809 NullFields []string `json:"-"` 1810 } 1811 1812 func (s *SegmentDimensionFilter) MarshalJSON() ([]byte, error) { 1813 type NoMethod SegmentDimensionFilter 1814 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1815 } 1816 1817 // SegmentFilter: SegmentFilter defines the segment to be either a simple or a 1818 // sequence segment. A simple segment condition contains dimension and metric 1819 // conditions to select the sessions or users. A sequence segment condition can 1820 // be used to select users or sessions based on sequential conditions. 1821 type SegmentFilter struct { 1822 // Not: If true, match the complement of simple or sequence segment. For 1823 // example, to match all visits not from "New York", we can define the segment 1824 // as follows: "sessionSegment": { "segmentFilters": [{ "simpleSegment" :{ 1825 // "orFiltersForSegment": [{ "segmentFilterClauses":[{ "dimensionFilter": { 1826 // "dimensionName": "ga:city", "expressions": ["New York"] } }] }] }, "not": 1827 // "True" }] }, 1828 Not bool `json:"not,omitempty"` 1829 // SequenceSegment: Sequence conditions consist of one or more steps, where 1830 // each step is defined by one or more dimension/metric conditions. Multiple 1831 // steps can be combined with special sequence operators. 1832 SequenceSegment *SequenceSegment `json:"sequenceSegment,omitempty"` 1833 // SimpleSegment: A Simple segment conditions consist of one or more 1834 // dimension/metric conditions that can be combined 1835 SimpleSegment *SimpleSegment `json:"simpleSegment,omitempty"` 1836 // ForceSendFields is a list of field names (e.g. "Not") to unconditionally 1837 // include in API requests. By default, fields with empty or default values are 1838 // omitted from API requests. See 1839 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1840 // details. 1841 ForceSendFields []string `json:"-"` 1842 // NullFields is a list of field names (e.g. "Not") to include in API requests 1843 // with the JSON null value. By default, fields with empty values are omitted 1844 // from API requests. See 1845 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1846 NullFields []string `json:"-"` 1847 } 1848 1849 func (s *SegmentFilter) MarshalJSON() ([]byte, error) { 1850 type NoMethod SegmentFilter 1851 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1852 } 1853 1854 // SegmentFilterClause: Filter Clause to be used in a segment definition, can 1855 // be wither a metric or a dimension filter. 1856 type SegmentFilterClause struct { 1857 // DimensionFilter: Dimension Filter for the segment definition. 1858 DimensionFilter *SegmentDimensionFilter `json:"dimensionFilter,omitempty"` 1859 // MetricFilter: Metric Filter for the segment definition. 1860 MetricFilter *SegmentMetricFilter `json:"metricFilter,omitempty"` 1861 // Not: Matches the complement (`!`) of the filter. 1862 Not bool `json:"not,omitempty"` 1863 // ForceSendFields is a list of field names (e.g. "DimensionFilter") to 1864 // unconditionally include in API requests. By default, fields with empty or 1865 // default values are omitted from API requests. See 1866 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1867 // details. 1868 ForceSendFields []string `json:"-"` 1869 // NullFields is a list of field names (e.g. "DimensionFilter") to include in 1870 // API requests with the JSON null value. By default, fields with empty values 1871 // are omitted from API requests. See 1872 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1873 NullFields []string `json:"-"` 1874 } 1875 1876 func (s *SegmentFilterClause) MarshalJSON() ([]byte, error) { 1877 type NoMethod SegmentFilterClause 1878 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1879 } 1880 1881 // SegmentMetricFilter: Metric filter to be used in a segment filter clause. 1882 type SegmentMetricFilter struct { 1883 // ComparisonValue: The value to compare against. If the operator is `BETWEEN`, 1884 // this value is treated as minimum comparison value. 1885 ComparisonValue string `json:"comparisonValue,omitempty"` 1886 // MaxComparisonValue: Max comparison value is only used for `BETWEEN` 1887 // operator. 1888 MaxComparisonValue string `json:"maxComparisonValue,omitempty"` 1889 // MetricName: The metric that will be filtered on. A `metricFilter` must 1890 // contain a metric name. 1891 MetricName string `json:"metricName,omitempty"` 1892 // Operator: Specifies is the operation to perform to compare the metric. The 1893 // default is `EQUAL`. 1894 // 1895 // Possible values: 1896 // "UNSPECIFIED_OPERATOR" - Unspecified operator is treated as `LESS_THAN` 1897 // operator. 1898 // "LESS_THAN" - Checks if the metric value is less than comparison value. 1899 // "GREATER_THAN" - Checks if the metric value is greater than comparison 1900 // value. 1901 // "EQUAL" - Equals operator. 1902 // "BETWEEN" - For between operator, both the minimum and maximum are 1903 // exclusive. We will use `LT` and `GT` for comparison. 1904 Operator string `json:"operator,omitempty"` 1905 // Scope: Scope for a metric defines the level at which that metric is defined. 1906 // The specified metric scope must be equal to or greater than its primary 1907 // scope as defined in the data model. The primary scope is defined by if the 1908 // segment is selecting users or sessions. 1909 // 1910 // Possible values: 1911 // "UNSPECIFIED_SCOPE" - If the scope is unspecified, it defaults to the 1912 // condition scope, `USER` or `SESSION` depending on if the segment is trying 1913 // to choose users or sessions. 1914 // "PRODUCT" - Product scope. 1915 // "HIT" - Hit scope. 1916 // "SESSION" - Session scope. 1917 // "USER" - User scope. 1918 Scope string `json:"scope,omitempty"` 1919 // ForceSendFields is a list of field names (e.g. "ComparisonValue") to 1920 // unconditionally include in API requests. By default, fields with empty or 1921 // default values are omitted from API requests. See 1922 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1923 // details. 1924 ForceSendFields []string `json:"-"` 1925 // NullFields is a list of field names (e.g. "ComparisonValue") to include in 1926 // API requests with the JSON null value. By default, fields with empty values 1927 // are omitted from API requests. See 1928 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1929 NullFields []string `json:"-"` 1930 } 1931 1932 func (s *SegmentMetricFilter) MarshalJSON() ([]byte, error) { 1933 type NoMethod SegmentMetricFilter 1934 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1935 } 1936 1937 // SegmentSequenceStep: A segment sequence definition. 1938 type SegmentSequenceStep struct { 1939 // MatchType: Specifies if the step immediately precedes or can be any time 1940 // before the next step. 1941 // 1942 // Possible values: 1943 // "UNSPECIFIED_MATCH_TYPE" - Unspecified match type is treated as precedes. 1944 // "PRECEDES" - Operator indicates that the previous step precedes the next 1945 // step. 1946 // "IMMEDIATELY_PRECEDES" - Operator indicates that the previous step 1947 // immediately precedes the next step. 1948 MatchType string `json:"matchType,omitempty"` 1949 // OrFiltersForSegment: A sequence is specified with a list of Or grouped 1950 // filters which are combined with `AND` operator. 1951 OrFiltersForSegment []*OrFiltersForSegment `json:"orFiltersForSegment,omitempty"` 1952 // ForceSendFields is a list of field names (e.g. "MatchType") to 1953 // unconditionally include in API requests. By default, fields with empty or 1954 // default values are omitted from API requests. See 1955 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1956 // details. 1957 ForceSendFields []string `json:"-"` 1958 // NullFields is a list of field names (e.g. "MatchType") to include in API 1959 // requests with the JSON null value. By default, fields with empty values are 1960 // omitted from API requests. See 1961 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1962 NullFields []string `json:"-"` 1963 } 1964 1965 func (s *SegmentSequenceStep) MarshalJSON() ([]byte, error) { 1966 type NoMethod SegmentSequenceStep 1967 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1968 } 1969 1970 // SequenceSegment: Sequence conditions consist of one or more steps, where 1971 // each step is defined by one or more dimension/metric conditions. Multiple 1972 // steps can be combined with special sequence operators. 1973 type SequenceSegment struct { 1974 // FirstStepShouldMatchFirstHit: If set, first step condition must match the 1975 // first hit of the visitor (in the date range). 1976 FirstStepShouldMatchFirstHit bool `json:"firstStepShouldMatchFirstHit,omitempty"` 1977 // SegmentSequenceSteps: The list of steps in the sequence. 1978 SegmentSequenceSteps []*SegmentSequenceStep `json:"segmentSequenceSteps,omitempty"` 1979 // ForceSendFields is a list of field names (e.g. 1980 // "FirstStepShouldMatchFirstHit") to unconditionally include in API requests. 1981 // By default, fields with empty or default values are omitted from API 1982 // requests. See https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields 1983 // for more details. 1984 ForceSendFields []string `json:"-"` 1985 // NullFields is a list of field names (e.g. "FirstStepShouldMatchFirstHit") to 1986 // include in API requests with the JSON null value. By default, fields with 1987 // empty values are omitted from API requests. See 1988 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1989 NullFields []string `json:"-"` 1990 } 1991 1992 func (s *SequenceSegment) MarshalJSON() ([]byte, error) { 1993 type NoMethod SequenceSegment 1994 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1995 } 1996 1997 // SimpleSegment: A Simple segment conditions consist of one or more 1998 // dimension/metric conditions that can be combined. 1999 type SimpleSegment struct { 2000 // OrFiltersForSegment: A list of segment filters groups which are combined 2001 // with logical `AND` operator. 2002 OrFiltersForSegment []*OrFiltersForSegment `json:"orFiltersForSegment,omitempty"` 2003 // ForceSendFields is a list of field names (e.g. "OrFiltersForSegment") to 2004 // unconditionally include in API requests. By default, fields with empty or 2005 // default values are omitted from API requests. See 2006 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 2007 // details. 2008 ForceSendFields []string `json:"-"` 2009 // NullFields is a list of field names (e.g. "OrFiltersForSegment") to include 2010 // in API requests with the JSON null value. By default, fields with empty 2011 // values are omitted from API requests. See 2012 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 2013 NullFields []string `json:"-"` 2014 } 2015 2016 func (s *SimpleSegment) MarshalJSON() ([]byte, error) { 2017 type NoMethod SimpleSegment 2018 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 2019 } 2020 2021 // TransactionData: Represents details collected when the visitor performs a 2022 // transaction on the page. 2023 type TransactionData struct { 2024 // TransactionId: The transaction ID, supplied by the e-commerce tracking 2025 // method, for the purchase in the shopping cart. 2026 TransactionId string `json:"transactionId,omitempty"` 2027 // TransactionRevenue: The total sale revenue (excluding shipping and tax) of 2028 // the transaction. 2029 TransactionRevenue float64 `json:"transactionRevenue,omitempty"` 2030 // TransactionShipping: Total cost of shipping. 2031 TransactionShipping float64 `json:"transactionShipping,omitempty"` 2032 // TransactionTax: Total tax for the transaction. 2033 TransactionTax float64 `json:"transactionTax,omitempty"` 2034 // ForceSendFields is a list of field names (e.g. "TransactionId") to 2035 // unconditionally include in API requests. By default, fields with empty or 2036 // default values are omitted from API requests. See 2037 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 2038 // details. 2039 ForceSendFields []string `json:"-"` 2040 // NullFields is a list of field names (e.g. "TransactionId") to include in API 2041 // requests with the JSON null value. By default, fields with empty values are 2042 // omitted from API requests. See 2043 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 2044 NullFields []string `json:"-"` 2045 } 2046 2047 func (s *TransactionData) MarshalJSON() ([]byte, error) { 2048 type NoMethod TransactionData 2049 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 2050 } 2051 2052 func (s *TransactionData) UnmarshalJSON(data []byte) error { 2053 type NoMethod TransactionData 2054 var s1 struct { 2055 TransactionRevenue gensupport.JSONFloat64 `json:"transactionRevenue"` 2056 TransactionShipping gensupport.JSONFloat64 `json:"transactionShipping"` 2057 TransactionTax gensupport.JSONFloat64 `json:"transactionTax"` 2058 *NoMethod 2059 } 2060 s1.NoMethod = (*NoMethod)(s) 2061 if err := json.Unmarshal(data, &s1); err != nil { 2062 return err 2063 } 2064 s.TransactionRevenue = float64(s1.TransactionRevenue) 2065 s.TransactionShipping = float64(s1.TransactionShipping) 2066 s.TransactionTax = float64(s1.TransactionTax) 2067 return nil 2068 } 2069 2070 // User: Contains information to identify a particular user uniquely. 2071 type User struct { 2072 // Type: Type of the user in the request. The field `userId` is associated with 2073 // this type. 2074 // 2075 // Possible values: 2076 // "USER_ID_TYPE_UNSPECIFIED" - When the User Id Type is not specified, the 2077 // default type used will be CLIENT_ID. 2078 // "USER_ID" - A single user, like a signed-in user account, that may 2079 // interact with content across one or more devices and / or browser instances. 2080 // "CLIENT_ID" - Analytics assigned client_id. 2081 Type string `json:"type,omitempty"` 2082 // UserId: Unique Id of the user for which the data is being requested. 2083 UserId string `json:"userId,omitempty"` 2084 // ForceSendFields is a list of field names (e.g. "Type") to unconditionally 2085 // include in API requests. By default, fields with empty or default values are 2086 // omitted from API requests. See 2087 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 2088 // details. 2089 ForceSendFields []string `json:"-"` 2090 // NullFields is a list of field names (e.g. "Type") to include in API requests 2091 // with the JSON null value. By default, fields with empty values are omitted 2092 // from API requests. See 2093 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 2094 NullFields []string `json:"-"` 2095 } 2096 2097 func (s *User) MarshalJSON() ([]byte, error) { 2098 type NoMethod User 2099 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 2100 } 2101 2102 // UserActivitySession: This represents a user session performed on a specific 2103 // device at a certain time over a period of time. 2104 type UserActivitySession struct { 2105 // Activities: Represents a detailed view into each of the activity in this 2106 // session. 2107 Activities []*Activity `json:"activities,omitempty"` 2108 // DataSource: The data source of a hit. By default, hits sent from 2109 // analytics.js are reported as "web" and hits sent from the mobile SDKs are 2110 // reported as "app". These values can be overridden in the Measurement 2111 // Protocol. 2112 DataSource string `json:"dataSource,omitempty"` 2113 // DeviceCategory: The type of device used: "mobile", "tablet" etc. 2114 DeviceCategory string `json:"deviceCategory,omitempty"` 2115 // Platform: Platform on which the activity happened: "android", "ios" etc. 2116 Platform string `json:"platform,omitempty"` 2117 // SessionDate: Date of this session in ISO-8601 format. 2118 SessionDate string `json:"sessionDate,omitempty"` 2119 // SessionId: Unique ID of the session. 2120 SessionId string `json:"sessionId,omitempty"` 2121 // ForceSendFields is a list of field names (e.g. "Activities") to 2122 // unconditionally include in API requests. By default, fields with empty or 2123 // default values are omitted from API requests. See 2124 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 2125 // details. 2126 ForceSendFields []string `json:"-"` 2127 // NullFields is a list of field names (e.g. "Activities") to include in API 2128 // requests with the JSON null value. By default, fields with empty values are 2129 // omitted from API requests. See 2130 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 2131 NullFields []string `json:"-"` 2132 } 2133 2134 func (s *UserActivitySession) MarshalJSON() ([]byte, error) { 2135 type NoMethod UserActivitySession 2136 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 2137 } 2138 2139 type ReportsBatchGetCall struct { 2140 s *Service 2141 getreportsrequest *GetReportsRequest 2142 urlParams_ gensupport.URLParams 2143 ctx_ context.Context 2144 header_ http.Header 2145 } 2146 2147 // BatchGet: Returns the Analytics data. 2148 func (r *ReportsService) BatchGet(getreportsrequest *GetReportsRequest) *ReportsBatchGetCall { 2149 c := &ReportsBatchGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2150 c.getreportsrequest = getreportsrequest 2151 return c 2152 } 2153 2154 // Fields allows partial responses to be retrieved. See 2155 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 2156 // details. 2157 func (c *ReportsBatchGetCall) Fields(s ...googleapi.Field) *ReportsBatchGetCall { 2158 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2159 return c 2160 } 2161 2162 // Context sets the context to be used in this call's Do method. 2163 func (c *ReportsBatchGetCall) Context(ctx context.Context) *ReportsBatchGetCall { 2164 c.ctx_ = ctx 2165 return c 2166 } 2167 2168 // Header returns a http.Header that can be modified by the caller to add 2169 // headers to the request. 2170 func (c *ReportsBatchGetCall) Header() http.Header { 2171 if c.header_ == nil { 2172 c.header_ = make(http.Header) 2173 } 2174 return c.header_ 2175 } 2176 2177 func (c *ReportsBatchGetCall) doRequest(alt string) (*http.Response, error) { 2178 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 2179 var body io.Reader = nil 2180 body, err := googleapi.WithoutDataWrapper.JSONReader(c.getreportsrequest) 2181 if err != nil { 2182 return nil, err 2183 } 2184 c.urlParams_.Set("alt", alt) 2185 c.urlParams_.Set("prettyPrint", "false") 2186 urls := googleapi.ResolveRelative(c.s.BasePath, "v4/reports:batchGet") 2187 urls += "?" + c.urlParams_.Encode() 2188 req, err := http.NewRequest("POST", urls, body) 2189 if err != nil { 2190 return nil, err 2191 } 2192 req.Header = reqHeaders 2193 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2194 } 2195 2196 // Do executes the "analyticsreporting.reports.batchGet" call. 2197 // Any non-2xx status code is an error. Response headers are in either 2198 // *GetReportsResponse.ServerResponse.Header or (if a response was returned at 2199 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2200 // check whether the returned error was because http.StatusNotModified was 2201 // returned. 2202 func (c *ReportsBatchGetCall) Do(opts ...googleapi.CallOption) (*GetReportsResponse, error) { 2203 gensupport.SetOptions(c.urlParams_, opts...) 2204 res, err := c.doRequest("json") 2205 if res != nil && res.StatusCode == http.StatusNotModified { 2206 if res.Body != nil { 2207 res.Body.Close() 2208 } 2209 return nil, gensupport.WrapError(&googleapi.Error{ 2210 Code: res.StatusCode, 2211 Header: res.Header, 2212 }) 2213 } 2214 if err != nil { 2215 return nil, err 2216 } 2217 defer googleapi.CloseBody(res) 2218 if err := googleapi.CheckResponse(res); err != nil { 2219 return nil, gensupport.WrapError(err) 2220 } 2221 ret := &GetReportsResponse{ 2222 ServerResponse: googleapi.ServerResponse{ 2223 Header: res.Header, 2224 HTTPStatusCode: res.StatusCode, 2225 }, 2226 } 2227 target := &ret 2228 if err := gensupport.DecodeResponse(target, res); err != nil { 2229 return nil, err 2230 } 2231 return ret, nil 2232 } 2233 2234 type UserActivitySearchCall struct { 2235 s *Service 2236 searchuseractivityrequest *SearchUserActivityRequest 2237 urlParams_ gensupport.URLParams 2238 ctx_ context.Context 2239 header_ http.Header 2240 } 2241 2242 // Search: Returns User Activity data. 2243 func (r *UserActivityService) Search(searchuseractivityrequest *SearchUserActivityRequest) *UserActivitySearchCall { 2244 c := &UserActivitySearchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2245 c.searchuseractivityrequest = searchuseractivityrequest 2246 return c 2247 } 2248 2249 // Fields allows partial responses to be retrieved. See 2250 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 2251 // details. 2252 func (c *UserActivitySearchCall) Fields(s ...googleapi.Field) *UserActivitySearchCall { 2253 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2254 return c 2255 } 2256 2257 // Context sets the context to be used in this call's Do method. 2258 func (c *UserActivitySearchCall) Context(ctx context.Context) *UserActivitySearchCall { 2259 c.ctx_ = ctx 2260 return c 2261 } 2262 2263 // Header returns a http.Header that can be modified by the caller to add 2264 // headers to the request. 2265 func (c *UserActivitySearchCall) Header() http.Header { 2266 if c.header_ == nil { 2267 c.header_ = make(http.Header) 2268 } 2269 return c.header_ 2270 } 2271 2272 func (c *UserActivitySearchCall) doRequest(alt string) (*http.Response, error) { 2273 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 2274 var body io.Reader = nil 2275 body, err := googleapi.WithoutDataWrapper.JSONReader(c.searchuseractivityrequest) 2276 if err != nil { 2277 return nil, err 2278 } 2279 c.urlParams_.Set("alt", alt) 2280 c.urlParams_.Set("prettyPrint", "false") 2281 urls := googleapi.ResolveRelative(c.s.BasePath, "v4/userActivity:search") 2282 urls += "?" + c.urlParams_.Encode() 2283 req, err := http.NewRequest("POST", urls, body) 2284 if err != nil { 2285 return nil, err 2286 } 2287 req.Header = reqHeaders 2288 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2289 } 2290 2291 // Do executes the "analyticsreporting.userActivity.search" call. 2292 // Any non-2xx status code is an error. Response headers are in either 2293 // *SearchUserActivityResponse.ServerResponse.Header or (if a response was 2294 // returned at all) in error.(*googleapi.Error).Header. Use 2295 // googleapi.IsNotModified to check whether the returned error was because 2296 // http.StatusNotModified was returned. 2297 func (c *UserActivitySearchCall) Do(opts ...googleapi.CallOption) (*SearchUserActivityResponse, error) { 2298 gensupport.SetOptions(c.urlParams_, opts...) 2299 res, err := c.doRequest("json") 2300 if res != nil && res.StatusCode == http.StatusNotModified { 2301 if res.Body != nil { 2302 res.Body.Close() 2303 } 2304 return nil, gensupport.WrapError(&googleapi.Error{ 2305 Code: res.StatusCode, 2306 Header: res.Header, 2307 }) 2308 } 2309 if err != nil { 2310 return nil, err 2311 } 2312 defer googleapi.CloseBody(res) 2313 if err := googleapi.CheckResponse(res); err != nil { 2314 return nil, gensupport.WrapError(err) 2315 } 2316 ret := &SearchUserActivityResponse{ 2317 ServerResponse: googleapi.ServerResponse{ 2318 Header: res.Header, 2319 HTTPStatusCode: res.StatusCode, 2320 }, 2321 } 2322 target := &ret 2323 if err := gensupport.DecodeResponse(target, res); err != nil { 2324 return nil, err 2325 } 2326 return ret, nil 2327 } 2328 2329 // Pages invokes f for each page of results. 2330 // A non-nil error returned from f will halt the iteration. 2331 // The provided context supersedes any context provided to the Context method. 2332 func (c *UserActivitySearchCall) Pages(ctx context.Context, f func(*SearchUserActivityResponse) error) error { 2333 c.ctx_ = ctx 2334 defer func(pt string) { c.searchuseractivityrequest.PageToken = pt }(c.searchuseractivityrequest.PageToken) 2335 for { 2336 x, err := c.Do() 2337 if err != nil { 2338 return err 2339 } 2340 if err := f(x); err != nil { 2341 return err 2342 } 2343 if x.NextPageToken == "" { 2344 return nil 2345 } 2346 c.searchuseractivityrequest.PageToken = x.NextPageToken 2347 } 2348 } 2349