Skip to main content

Network Events

Send network request event data into Fullstory

Network Capture provides the ability to identify and analyze network calls via DevTools in Session Playback for mobile sessions. This creates the ability to create segments & funnels based on these common network events for Mobile Apps.

Fullstory supports autocapture for two popular networking packages, http and dio. Configure whichever your app uses, the other will be tree-shaken out by the compiler.

Autocapture package:http

If you already use package:http_interceptor to intercept package:http's traffic, simply add FSInterceptor to your client's configuration:

import 'package:fullstory_flutter/network/http.dart';

final client = InterceptedClient.build(
/* Your other configuration here */
interceptors: [
/* Your other interceptors here */
FSInterceptor(),
],
);

If you do not use package:http_interceptor, you can use fsHttpClient() as a drop-in replacement for the default Client to configure autocapture:

Client get httpClient => fs_http.fsHttpClient();
Parameters
    captureFirst String optional

    Whether Fullstory should capture data before or after it has been handled by any other interceptors.

See InterceptedClient's documentation for further documentation on other parameters.

Autocapture package:dio

Add FSInterceptor to your Dio client's interceptors to begin autocapture:

import 'package:fullstory_flutter/network/dio.dart';

final dio = Dio()
/* Your dio configuration here */
..interceptors.add(FSInterceptor());

Manual capture

This API allows manual reporting of network events if autocapture from package:http or package:dio is unavailable. Where possible, prefer using FSInterceptor with your choice of networking library.

Parameters
    url String required

    The target URL for the network request.

    method String required

    HTTP method of the request, such as "GET" or "POST".

    statusCode int optional

    The HTTP status code of the response, such as 200 or 404.

    durationMs int optional

    The time, in milliseconds, between when the request was sent and response received.

    requestSize int optional

    The size, in bytes, of the request.

    response int optional

    The size, in bytes, of the response.

Limits

  • Sustained calls are limited to 60 calls per minute, with a burst limit of 40 calls per second.

Additional Information

FS.networkEvent({
required String url,
required String method,
int? statusCode,
int? durationMs,
int? requestSize,
int? responseSize,
})

Example Invocation

Capturing a visit to fullstory.com

FS.networkEvent(
url: 'https://www.fullstory.com',
method: 'GET',
statusCode: 200,
durationMs: 300,
requestSize: 256,
responseSize: 512,
);