Analytics Reporting API . userActivity

Instance Methods

search(body=None, x__xgafv=None)

Returns User Activity data.

search_next(previous_request=*, previous_response=*)

Retrieves the next page of results.

Method Details

search(body=None, x__xgafv=None)
Returns User Activity data.

Args:
  body: object, The request body.
    The object takes the form of:

{ # The request to fetch User Report from Reporting API `userActivity:get` call.
    "pageSize": 42, # Page size is for paging and specifies the maximum number of returned rows.
        # Page size should be > 0. If the value is 0 or if the field isn't specified,
        # the request returns the default of 1000 rows per page.
    "dateRange": { # A contiguous set of days: startDate, startDate + 1 day, ..., endDate. # Date range for which to retrieve the user activity. If a date range is not
        # provided, the default date range is (startDate: current date - 7 days,
        # endDate: current date - 1 day).
        # The start and end dates are specified in
        # [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) date format `YYYY-MM-DD`.
      "startDate": "A String", # The start date for the query in the format `YYYY-MM-DD`.
      "endDate": "A String", # The end date for the query in the format `YYYY-MM-DD`.
    },
    "activityTypes": [ # Set of all activity types being requested. Only acvities matching these
        # types will be returned in the response. If empty, all activies will be
        # returned.
      "A String",
    ],
    "pageToken": "A String", # A continuation token to get the next page of the results. Adding this to
        # the request will return the rows after the pageToken. The pageToken should
        # be the value returned in the nextPageToken parameter in the response to
        # the [SearchUserActivityRequest](#SearchUserActivityRequest) request.
    "user": { # Contains information to identify a particular user uniquely. # Required. Unique user Id to query for. Every
        # [SearchUserActivityRequest](#SearchUserActivityRequest) must contain this
        # field.
      "userId": "A String", # Unique Id of the user for which the data is being requested.
      "type": "A String", # Type of the user in the request. The field `userId` is associated with this
          # type.
    },
    "viewId": "A String", # Required. The Analytics
        # [view ID](https://support.google.com/analytics/answer/1009618)
        # from which to retrieve data. Every
        # [SearchUserActivityRequest](#SearchUserActivityRequest) must contain the
        # `viewId`.
  }

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # The response from `userActivity:get` call.
    "nextPageToken": "A String", # This token should be passed to
        # [SearchUserActivityRequest](#SearchUserActivityRequest) to retrieve the
        # next page.
    "sampleRate": 3.14, # This field represents the
        # [sampling rate](https://support.google.com/analytics/answer/2637192) for
        # the given request and is a number between 0.0 to 1.0. See
        # [developer guide](/analytics/devguides/reporting/core/v4/basics#sampling)
        # for details.
    "totalRows": 42, # Total rows returned by this query (across different pages).
    "sessions": [ # Each record represents a session (device details, duration, etc).
      { # This represents a user session performed on a specific device at a certain
          # time over a period of time.
        "activities": [ # Represents a detailed view into each of the activity in this session.
          { # An Activity represents data for an activity of a user. Note that an
              # Activity is different from a hit.
              # A hit might result in multiple Activity's. For example, if a hit
              # includes a transaction and a goal completion, there will be two
              # Activity protos for this hit, one for ECOMMERCE and one for GOAL.
              # Conversely, multiple hits can also construct one Activity. In classic
              # e-commerce, data for one transaction might be sent through multiple hits.
              # These hits will be merged into one ECOMMERCE Activity.
            "customDimension": [ # A list of all custom dimensions associated with this activity.
              { # Custom dimension.
                "index": 42, # Slot number of custom dimension.
                "value": "A String", # Value of the custom dimension. Default value (i.e. empty string) indicates
                    # clearing sesion/visitor scope custom dimension value.
              },
            ],
            "pageview": { # Represents details collected when the visitor views a page. # This will be set if `activity_type` equals `PAGEVIEW`. This field
                # contains all the details about the visitor and the page that was visited.
              "pageTitle": "A String", # The title of the page that the visitor viewed.
              "pagePath": "A String", # The URL of the page that the visitor viewed.
            },
            "medium": "A String", # The type of referrals. For manual campaign tracking, it is the value of the
                # utm_medium campaign tracking parameter. For AdWords autotagging, it is cpc.
                # If users came from a search engine detected by Google Analytics, it is
                # organic. If the referrer is not a search engine, it is referral. If users
                # came directly to the property and document.referrer is empty, its value is
                # (none).
            "keyword": "A String", # For manual campaign tracking, it is the value of the utm_term campaign
                # tracking parameter. For AdWords traffic, it contains the best matching
                # targeting criteria. For the display network, where multiple targeting
                # criteria could have caused the ad to show up, it returns the best matching
                # targeting criteria as selected by Ads. This could be display_keyword, site
                # placement, boomuserlist, user_interest, age, or gender. Otherwise its value
                # is (not set).
            "campaign": "A String", # For manual campaign tracking, it is the value of the utm_campaign campaign
                # tracking parameter. For AdWords autotagging, it is the name(s) of the
                # online ad campaign(s) you use for the property. If you use neither, its
                # value is (not set).
            "hostname": "A String", # The hostname from which the tracking request was made.
            "landingPagePath": "A String", # The first page in users' sessions, or the landing page.
            "event": { # Represents all the details pertaining to an event. # This field contains all the details pertaining to an event and will be
                # set if `activity_type` equals `EVENT`.
              "eventLabel": "A String", # Label attached with the event.
              "eventValue": "A String", # Numeric value associated with the event.
              "eventCount": "A String", # Number of such events in this activity.
              "eventAction": "A String", # Type of interaction with the object. Eg: 'play'.
              "eventCategory": "A String", # The object on the page that was interacted with. Eg: 'Video'.
            },
            "source": "A String", # The source of referrals. For manual campaign tracking, it is the value of
                # the utm_source campaign tracking parameter. For AdWords autotagging, it is
                # google. If you use neither, it is the domain of the source
                # (e.g., document.referrer) referring the users. It may also contain a port
                # address. If users arrived without a referrer, its value is (direct).
            "activityType": "A String", # Type of this activity.
            "channelGrouping": "A String", # The Channel Group associated with an end user's session for this View
                # (defined by the View's Channel Groupings).
            "activityTime": "A String", # Timestamp of the activity. If activities for a visit cross midnight and
                # occur in two separate dates, then two sessions (one per date)
                # share the session identifier.
                # For example, say session ID 113472 has activity within 2019-08-20, and
                # session ID 243742 has activity within 2019-08-25 and 2019-08-26. Session ID
                # 113472 is one session, and session ID 243742 is two sessions.
            "appview": { # This will be set if `activity_type` equals `SCREEN_VIEW`.
              "mobileDeviceBranding": "A String", # Mobile manufacturer or branded name. Eg: "Google", "Apple" etc.
              "mobileDeviceModel": "A String", # Mobile device model. Eg: "Pixel", "iPhone" etc.
              "screenName": "A String", # The name of the screen.
              "appName": "A String", # The application name.
            },
            "ecommerce": { # E-commerce details associated with the user activity. # This will be set if `activity_type` equals `ECOMMERCE`.
              "actionType": "A String", # Action associated with this e-commerce action.
              "transaction": { # Represents details collected when the visitor performs a transaction on the # Transaction details of this e-commerce action.
                  # page.
                "transactionTax": 3.14, # Total tax for the transaction.
                "transactionRevenue": 3.14, # The total sale revenue (excluding shipping and tax) of the transaction.
                "transactionId": "A String", # The transaction ID, supplied by the e-commerce tracking method, for the
                    # purchase in the shopping cart.
                "transactionShipping": 3.14, # Total cost of shipping.
              },
              "products": [ # Details of the products in this transaction.
                { # Details of the products in an e-commerce transaction.
                  "productSku": "A String", # Unique code that represents the product.
                  "itemRevenue": 3.14, # The total revenue from purchased product items.
                  "productQuantity": "A String", # Total number of this product units in the transaction.
                  "productName": "A String", # The product name, supplied by the e-commerce tracking application, for
                      # the purchased items.
                },
              ],
              "ecommerceType": "A String", # The type of this e-commerce activity.
            },
            "goals": { # Represents a set of goals that were reached in an activity. # This field contains a list of all the goals that were reached in this
                # activity when `activity_type` equals `GOAL`.
              "goals": [ # All the goals that were reached in the current activity.
                { # Represents all the details pertaining to a goal.
                  "goalCompletions": "A String", # Total number of goal completions in this activity.
                  "goalValue": 3.14, # Value in this goal.
                  "goalName": "A String", # Name of the goal.
                  "goalPreviousStep1": "A String", # URL of the page one step prior to the goal completion.
                  "goalPreviousStep3": "A String", # URL of the page three steps prior to the goal completion.
                  "goalPreviousStep2": "A String", # URL of the page two steps prior to the goal completion.
                  "goalIndex": 42, # This identifies the goal as configured for the profile.
                  "goalCompletionLocation": "A String", # URL of the page where this goal was completed.
                },
              ],
            },
          },
        ],
        "sessionDate": "A String", # Date of this session in ISO-8601 format.
        "deviceCategory": "A String", # The type of device used: "mobile", "tablet" etc.
        "platform": "A String", # Platform on which the activity happened: "android", "ios" etc.
        "sessionId": "A String", # Unique ID of the session.
        "dataSource": "A String", # The data source of a hit. By default, hits sent from analytics.js are
            # reported as "web" and hits sent from the mobile SDKs are reported as "app".
            # These values can be overridden in the Measurement Protocol.
      },
    ],
  }
search_next(previous_request=*, previous_response=*)
Retrieves the next page of results.

Args:
  previous_request: The request for the previous page. (required)
  previous_response: The response from the request for the previous page. (required)

Returns:
  A request object that you can call 'execute()' on to request the next
  page. Returns None if there are no more items in the collection.