Gleap allows you to log all network requests, to get a better understanding of what went wrong. This usually works out of the box: enable Network logs in the Developer options of your project in the Gleap dashboard.
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.
Keys in the exclusion list load with the widget configuration. Before sending a report, the SDK strips matching key/value pairs from captured headers and JSON request and response data.
This ensures that sensitive information will never even leave the client application.
Example:
If you want to remove the Authorization bearer token from your requests, simply add "Authorization" to the list of keys.
Set filter with code
It's also possible to set the network log filters by code.
// Manually set the network logs filters
cordova.plugins.GleapPlugin.setNetworkLogPropsToIgnore([
"api-key",
"user.password",
"...",
]);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.
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.
// Manually set the network logs blacklist
cordova.plugins.GleapPlugin.setNetworkLogsBlacklist([
"analytics.example.com",
"...",
]);
