collect method
Writes a single user event from the browser.
This uses a GET request to due to browser restriction of POST-ing to a 3rd party domain. This method is used only by the Recommendations AI JavaScript pixel. Users should not call this method directly.
Request parameters:
parent
- Required. The parent eventStore name, such as
projects/1234/locations/global/catalogs/default_catalog/eventStores/default_event_store
.
Value must have pattern
^projects/\[^/\]+/locations/\[^/\]+/catalogs/\[^/\]+/eventStores/\[^/\]+$
.
ets
- Optional. The event timestamp in milliseconds. This prevents
browser caching of otherwise identical get requests. The name is
abbreviated to reduce the payload bytes.
uri
- Optional. The url including cgi-parameters but excluding the hash
fragment. The URL must be truncated to 1.5K bytes to conservatively be
under the 2K bytes. This is often more useful than the referer url,
because many browsers only send the domain for 3rd party requests.
userEvent
- Required. URL encoded UserEvent proto.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a GoogleApiHttpBody.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<GoogleApiHttpBody> collect(
core.String parent, {
core.String? ets,
core.String? uri,
core.String? userEvent,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if (ets != null) 'ets': [ets],
if (uri != null) 'uri': [uri],
if (userEvent != null) 'userEvent': [userEvent],
if ($fields != null) 'fields': [$fields],
};
final url_ =
'v1beta1/' + core.Uri.encodeFull('$parent') + '/userEvents:collect';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return GoogleApiHttpBody.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}