• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5  margin: 0;
6  padding: 0;
7  border: 0;
8  font-weight: inherit;
9  font-style: inherit;
10  font-size: 100%;
11  font-family: inherit;
12  vertical-align: baseline;
13}
14
15body {
16  font-size: 13px;
17  padding: 1em;
18}
19
20h1 {
21  font-size: 26px;
22  margin-bottom: 1em;
23}
24
25h2 {
26  font-size: 24px;
27  margin-bottom: 1em;
28}
29
30h3 {
31  font-size: 20px;
32  margin-bottom: 1em;
33  margin-top: 1em;
34}
35
36pre, code {
37  line-height: 1.5;
38  font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42  margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46  font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50  border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54  margin-top: 0.5em;
55}
56
57.firstline {
58  margin-left: 2 em;
59}
60
61.method  {
62  margin-top: 1em;
63  border: solid 1px #CCC;
64  padding: 1em;
65  background: #EEE;
66}
67
68.details {
69  font-weight: bold;
70  font-size: 14px;
71}
72
73</style>
74
75<h1><a href="analyticsreporting_v4.html">Analytics Reporting API</a> . <a href="analyticsreporting_v4.userActivity.html">userActivity</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
78  <code><a href="#search">search(body, x__xgafv=None)</a></code></p>
79<p class="firstline">Returns User Activity data.</p>
80<p class="toc_element">
81  <code><a href="#search_next">search_next(previous_request, previous_response)</a></code></p>
82<p class="firstline">Retrieves the next page of results.</p>
83<h3>Method Details</h3>
84<div class="method">
85    <code class="details" id="search">search(body, x__xgafv=None)</code>
86  <pre>Returns User Activity data.
87
88Args:
89  body: object, The request body. (required)
90    The object takes the form of:
91
92{ # The request to fetch User Report from Reporting API `userActivity:get` call.
93    "pageSize": 42, # Page size is for paging and specifies the maximum number of returned rows.
94        # Page size should be > 0. If the value is 0 or if the field isn't specified,
95        # the request returns the default of 1000 rows per page.
96    "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
97        # provided, the default date range is (startDate: current date - 7 days,
98        # endDate: current date - 1 day).
99        # The start and end dates are specified in
100        # [ISO8601](https://en.wikipedia.org/wiki/ISO_8601) date format `YYYY-MM-DD`.
101      "startDate": "A String", # The start date for the query in the format `YYYY-MM-DD`.
102      "endDate": "A String", # The end date for the query in the format `YYYY-MM-DD`.
103    },
104    "activityTypes": [ # Set of all activity types being requested. Only acvities matching these
105        # types will be returned in the response. If empty, all activies will be
106        # returned.
107      "A String",
108    ],
109    "pageToken": "A String", # A continuation token to get the next page of the results. Adding this to
110        # the request will return the rows after the pageToken. The pageToken should
111        # be the value returned in the nextPageToken parameter in the response to
112        # the [SearchUserActivityRequest](#SearchUserActivityRequest) request.
113    "user": { # Contains information to identify a particular user uniquely. # Required. Unique user Id to query for. Every
114        # [SearchUserActivityRequest](#SearchUserActivityRequest) must contain this
115        # field.
116      "type": "A String", # Type of the user in the request. The field `userId` is associated with this
117          # type.
118      "userId": "A String", # Unique Id of the user for which the data is being requested.
119    },
120    "viewId": "A String", # Required. The Analytics
121        # [view ID](https://support.google.com/analytics/answer/1009618)
122        # from which to retrieve data. Every
123        # [SearchUserActivityRequest](#SearchUserActivityRequest) must contain the
124        # `viewId`.
125  }
126
127  x__xgafv: string, V1 error format.
128    Allowed values
129      1 - v1 error format
130      2 - v2 error format
131
132Returns:
133  An object of the form:
134
135    { # The response from `userActivity:get` call.
136    "nextPageToken": "A String", # This token should be passed to
137        # [SearchUserActivityRequest](#SearchUserActivityRequest) to retrieve the
138        # next page.
139    "sampleRate": 3.14, # This field represents the
140        # [sampling rate](https://support.google.com/analytics/answer/2637192) for
141        # the given request and is a number between 0.0 to 1.0. See
142        # [developer guide](/analytics/devguides/reporting/core/v4/basics#sampling)
143        # for details.
144    "totalRows": 42, # Total rows returned by this query (across different pages).
145    "sessions": [ # Each record represents a session (device details, duration, etc).
146      { # This represents a user session performed on a specific device at a certain
147          # time over a period of time.
148        "activities": [ # Represents a detailed view into each of the activity in this session.
149          { # An Activity represents data for an activity of a user. Note that an
150              # Activity is different from a hit.
151              # A hit might result in multiple Activity's. For example, if a hit
152              # includes a transaction and a goal completion, there will be two
153              # Activity protos for this hit, one for ECOMMERCE and one for GOAL.
154              # Conversely, multiple hits can also construct one Activity. In classic
155              # e-commerce, data for one transaction might be sent through multiple hits.
156              # These hits will be merged into one ECOMMERCE Activity.
157            "customDimension": [ # A list of all custom dimensions associated with this activity.
158              { # Custom dimension.
159                "index": 42, # Slot number of custom dimension.
160                "value": "A String", # Value of the custom dimension. Default value (i.e. empty string) indicates
161                    # clearing sesion/visitor scope custom dimension value.
162              },
163            ],
164            "landingPagePath": "A String", # The first page in users' sessions, or the landing page.
165            "hostname": "A String", # The hostname from which the tracking request was made.
166            "ecommerce": { # E-commerce details associated with the user activity. # This will be set if `activity_type` equals `ECOMMERCE`.
167              "ecommerceType": "A String", # The type of this e-commerce activity.
168              "transaction": { # Represents details collected when the visitor performs a transaction on the # Transaction details of this e-commerce action.
169                  # page.
170                "transactionTax": 3.14, # Total tax for the transaction.
171                "transactionId": "A String", # The transaction ID, supplied by the e-commerce tracking method, for the
172                    # purchase in the shopping cart.
173                "transactionShipping": 3.14, # Total cost of shipping.
174                "transactionRevenue": 3.14, # The total sale revenue (excluding shipping and tax) of the transaction.
175              },
176              "actionType": "A String", # Action associated with this e-commerce action.
177              "products": [ # Details of the products in this transaction.
178                { # Details of the products in an e-commerce transaction.
179                  "productSku": "A String", # Unique code that represents the product.
180                  "itemRevenue": 3.14, # The total revenue from purchased product items.
181                  "productQuantity": "A String", # Total number of this product units in the transaction.
182                  "productName": "A String", # The product name, supplied by the e-commerce tracking application, for
183                      # the purchased items.
184                },
185              ],
186            },
187            "keyword": "A String", # For manual campaign tracking, it is the value of the utm_term campaign
188                # tracking parameter. For AdWords traffic, it contains the best matching
189                # targeting criteria. For the display network, where multiple targeting
190                # criteria could have caused the ad to show up, it returns the best matching
191                # targeting criteria as selected by Ads. This could be display_keyword, site
192                # placement, boomuserlist, user_interest, age, or gender. Otherwise its value
193                # is (not set).
194            "campaign": "A String", # For manual campaign tracking, it is the value of the utm_campaign campaign
195                # tracking parameter. For AdWords autotagging, it is the name(s) of the
196                # online ad campaign(s) you use for the property. If you use neither, its
197                # value is (not set).
198            "activityType": "A String", # Type of this activity.
199            "pageview": { # Represents details collected when the visitor views a page. # This will be set if `activity_type` equals `PAGEVIEW`. This field
200                # contains all the details about the visitor and the page that was visited.
201              "pageTitle": "A String", # The title of the page that the visitor viewed.
202              "pagePath": "A String", # The URL of the page that the visitor viewed.
203            },
204            "appview": { # This will be set if `activity_type` equals `SCREEN_VIEW`.
205              "mobileDeviceBranding": "A String", # Mobile manufacturer or branded name. Eg: "Google", "Apple" etc.
206              "mobileDeviceModel": "A String", # Mobile device model. Eg: "Pixel", "iPhone" etc.
207              "appName": "A String", # The application name.
208              "screenName": "A String", # The name of the screen.
209            },
210            "source": "A String", # The source of referrals. For manual campaign tracking, it is the value of
211                # the utm_source campaign tracking parameter. For AdWords autotagging, it is
212                # google. If you use neither, it is the domain of the source
213                # (e.g., document.referrer) referring the users. It may also contain a port
214                # address. If users arrived without a referrer, its value is (direct).
215            "medium": "A String", # The type of referrals. For manual campaign tracking, it is the value of the
216                # utm_medium campaign tracking parameter. For AdWords autotagging, it is cpc.
217                # If users came from a search engine detected by Google Analytics, it is
218                # organic. If the referrer is not a search engine, it is referral. If users
219                # came directly to the property and document.referrer is empty, its value is
220                # (none).
221            "channelGrouping": "A String", # The Channel Group associated with an end user's session for this View
222                # (defined by the View's Channel Groupings).
223            "activityTime": "A String", # Timestamp of the activity.
224            "event": { # Represents all the details pertaining to an event. # This field contains all the details pertaining to an event and will be
225                # set if `activity_type` equals `EVENT`.
226              "eventLabel": "A String", # Label attached with the event.
227              "eventValue": "A String", # Numeric value associated with the event.
228              "eventAction": "A String", # Type of interaction with the object. Eg: 'play'.
229              "eventCategory": "A String", # The object on the page that was interacted with. Eg: 'Video'.
230              "eventCount": "A String", # Number of such events in this activity.
231            },
232            "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
233                # activity when `activity_type` equals `GOAL`.
234              "goals": [ # All the goals that were reached in the current activity.
235                { # Represents all the details pertaining to a goal.
236                  "goalCompletions": "A String", # Total number of goal completions in this activity.
237                  "goalValue": 3.14, # Value in this goal.
238                  "goalName": "A String", # Name of the goal.
239                  "goalPreviousStep1": "A String", # URL of the page one step prior to the goal completion.
240                  "goalPreviousStep3": "A String", # URL of the page three steps prior to the goal completion.
241                  "goalPreviousStep2": "A String", # URL of the page two steps prior to the goal completion.
242                  "goalIndex": 42, # This identifies the goal as configured for the profile.
243                  "goalCompletionLocation": "A String", # URL of the page where this goal was completed.
244                },
245              ],
246            },
247          },
248        ],
249        "sessionDate": "A String", # Date of this session in ISO-8601 format.
250        "deviceCategory": "A String", # The type of device used: "mobile", "tablet" etc.
251        "platform": "A String", # Platform on which the activity happened: "android", "ios" etc.
252        "sessionId": "A String", # Unique ID of the session.
253        "dataSource": "A String", # The data source of a hit. By default, hits sent from analytics.js are
254            # reported as "web" and hits sent from the mobile SDKs are reported as "app".
255            # These values can be overridden in the Measurement Protocol.
256      },
257    ],
258  }</pre>
259</div>
260
261<div class="method">
262    <code class="details" id="search_next">search_next(previous_request, previous_response)</code>
263  <pre>Retrieves the next page of results.
264
265Args:
266  previous_request: The request for the previous page. (required)
267  previous_response: The response from the request for the previous page. (required)
268
269Returns:
270  A request object that you can call 'execute()' on to request the next
271  page. Returns None if there are no more items in the collection.
272    </pre>
273</div>
274
275</body></html>