Gleap logs your app's network requests and attaches the most recent ones to every ticket, so you can see what went wrong. Network logs work out of the box: enable Network logs in the Developer options of your project in the Gleap dashboard.
On iOS and Android the plugin records the fetch and XMLHttpRequest requests of your app's WebView (also with CapacitorHttp enabled) and hands them to the native SDK; on the web the JavaScript SDK records them. For each request Gleap logs the method, URL, request and response headers and bodies, the status, the duration and, for failed, aborted or timed-out requests, the error. Text bodies are kept up to 150 KB; binary and streaming bodies (images, server-sent events) are left out. The last 30 requests are attached to a ticket.
On iOS and Android, WebView requests are recorded once the project configuration with network logs enabled has loaded; earlier requests are not logged. The plugin has no method to start network logging from code.
Filtering network logs
Gleap allows you to strip off specific key/value pairs from network logs. This empowers you to easily remove sensitive data like tokens, passwords or usernames.
How does it work?
Open Settings → Developer → Developer options → Network logs and add keys under Ignored keys. Use Excluded domains for hosts whose requests should not be recorded. These settings load with the widget configuration and are applied on the device before a report is sent.
Headers: request and response headers with a matching name are removed (the name is matched case-insensitively).
JSON bodies: matching keys are removed from request and response bodies at any depth, including objects inside arrays. A key with dots, like
user.password, also removes exactly that path.Form bodies and URL parameters: matching
application/x-www-form-urlencodedfields and query parameters are removed.
Independent of this list, the values of the Authorization, Proxy-Authorization, Cookie and Set-Cookie headers are always replaced by [REDACTED].
Example
To remove an API key header and every password field, add x-api-key and password to the list.
Set filter with code
It's also possible to set the network log filters by code. Each call replaces the previous list. The keys set in the dashboard apply in addition.
Gleap.setNetworkLogPropsToIgnore({ propsToIgnore: ["x-api-key", "password", "user.email"] });Blacklisting URLs
It is possible to blacklist URLs or parts of URLs. If a network request matches one of the entries in the blacklist, the network request won't be included in the network logs.
gleap.io and gleap.ai, the domain of the US data region) are always excluded from the network logs, so you don't need to blacklist them yourself. The JavaScript SDK does this since v18.0.0, the iOS, Android, React Native, Flutter and Ionic Capacitor SDKs since v19.0.0.To add a new entry to the blacklist, open your project in the Gleap dashboard, go to Developer options and add the URLs under Network logs → Excluded domains.
Set blacklist with code
It's also possible to set the network log blacklist by code. Each call replaces the previous list. The domains set in the dashboard apply in addition.
Gleap.setNetworkLogsBlacklist({ blacklist: ["analytics.example.com", "..."] });
