Data Collection Custom Rules¶
Resource Collection Filtering¶
The macOS SDK supports customizing Resource collection rules via FTRumConfig.resourceUrlHandler.
| Property | Type | Description |
|---|---|---|
resourceUrlHandler |
FTResourceUrlHandler |
Custom rule for collecting Resources. By default, no filtering is applied. Returning NO indicates collection is required, returning YES indicates collection is not required. |
When you only want to collect resources from specific domains or paths, or need to filter out internal requests or heartbeat requests, you can set this rule uniformly during the initialization of FTRumConfig.
FTRumConfig *rumConfig = [[FTRumConfig alloc] initWithAppid:appid];
rumConfig.resourceUrlHandler = ^BOOL(NSURL *url) {
// Return NO to collect, return YES to filter.
return NO;
};
[[FTSDKAgent sharedInstance] startRumWithConfigOptions:rumConfig];
If you also need to manually assemble Resource events, you can further refer to the manual Resource collection method in RUM Configuration.