getEventTagJs method

Future<MultipartFile?> getEventTagJs()

The Hanzo event tag — the one-line install for a surface with no bundler

Serves the browser tag that autocaptures pageviews (initial and SPA) and uncaught errors onto the canonical wire at POST /v1/event. Install is one line, and it is the same line for a Hanzo property and for a customer's own page: <script defer src="https://api.hanzo.ai/v1/event/tag.js" data-key="pk-…"> data-key is the publishable key the project mints; data-product optionally names the emitting surface. The key may also ride the src as ?key= for a host that strips data attributes. WITHOUT A KEY THE TAG SENDS NOTHING. A keyless beacon is accepted 200 into $public, a reserved tenant the owning org cannot read — so silence is the honest failure, and the tag picks it rather than reporting success into a tenant nobody reads.

Implementation

Future<MultipartFile?> getEventTagJs() async {
  final response = await getEventTagJsWithHttpInfo();
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'MultipartFile',) as MultipartFile;

  }
  return null;
}