CRFilter

By default, Workspace ONE Intelligence SDK reports Network Insights data for all URLs that are accessed by your app and stripps each URL of any query parameters. For example, http://foo.com?name=critter becomes http://foo.com. This is done to ensure personal information is not transmitted to Workspace ONE Intelligence.

It is also possible to customise filter blacklists that will completely discard matching URLs. Network Insights data that pertains to any URL that matches the blacklist will not be reported to Workspace ONE Intelligence.

Use the [CRFilter filterWithString:] to modify the default filtering behavior:

// Add filters at initialization
CrittercismConfig *config = [CrittercismConfig defaultConfig];
config.urlFilters = @[[CRFilter filterWithString:@"sensitiveURL"],
                      [CRFilter filterWithString:@"additionalURL"]];
[Crittercism enableWithAppID:@"MYAPPID" andConfig:config];

// Add filters later on
[Crittercism addFilter:[CRFilter filterWithString:@"anotherURL"]];
// Swift 2.X

// Add filters at initialization
let config = CrittercismConfig.defaultConfig();
config.urlFilters = [CRFilter(string: "sensitiveURL"), CRFilter(string: "additionalURL")]
Crittercism.enableWithAppID("MYAPPID", andConfig: config)

// Add filters later on
Crittercism.addFilter(CRFilter(string: "sensitiveURL"))

// Swift 3.x

// Add filters at initialization
let config : CrittercismConfig = CrittercismConfig.default()
config.urlFilters = [CRFilter(string: "sensitiveURL"), CRFilter(string: "additionalURL")]
Crittercism.enable(withAppID: appID, and config: config)

// Add filters later on
Crittercism.add(filter: CRFilter)

Note

  • Filters match URLs via case sensitive substring matching
  • Older versions of the agent did not scrub query parameters by default, and so a `queryOnlyFilter` existed. To avoid compile time errors for existing Workspace ONE Intelligence users, this filter type can still be created, but it will be ignored by the library. This filter type is deprecated, and will be removed in a future version of the agent.

Creating a Filter

+ filterWithString:
Convenience method to create a blacklisting filter.
+ (CRFilter *)filterWithString:(NSString *)matchToken;
// Swift 2.X
class func filterWithString(matchToken: String)

// Swift 3.x
class func filter(withString: matchToken)
matchToken An NSString of the url to filter
A CRFilter object for matchToken.
+ queryPreservingFilterWithString:
Convenience method to create a filter which preserves the query portion of.
+ (CRFilter *)queryPreservingFilterWithString:(NSString *)matchToken
// Swift 2.X
class func queryPreservingFilterWithString(matchToken: String)
matchToken An NSString of the url to filter
- initWithString:
Initialize a filter that blacklists all URLs that match the specified token.
- (id)initWithString:(NSString *)matchToken;
// Swift 2.X and 3.x
init?(string matchToken: String)
matchToken An NSString of the url to filter
A CRFilter object of type CRFilterTypeBlacklist
- initWithString:andFilterType:
Initialize a filter that blacklists all URLs that match the specified token.
- (id)initWithString:(NSString *)matchToken
       andFilterType:(CRFilterType)filterType;
// Swift 2.X and 3.x
init?(string matchToken: String,
  filterType filterType: CRFilterType)
matchToken An NSString of the url to filter
filterType Indicates filter type
A CRFilter object with the indicated filter type.

Other Methods

+ applyFilter:ToURL:
Filter a URL, specifying which type of filter to use.
+ (NSString *)applyFilter:(CRFilterType)filterType
                    ToURL:(NSString *)url;
// Swift 2.X and 3.x
class func applyFilter(filterType: CRFilterType,
                        ToURL url: String)
filterType Specifies the filter type
url Specifies the url
Deprecated in 5.9.3
Returns nil when a blacklist filter is specified.

Constants

CRFilterType
The filter type of CRFilter
typedef enum : NSInteger {
   CRFilterTypeScrubQuery,
   CRFilterTypeBlacklist,
   CRFilterTypePreserveQuery,
   CRFilterTypePreserveFragment,
   CRFilterTypePreserveParameters,
   CRFilterTypePreserveAll
} UIApplicationState;
// Swift 2.X and 3.x
enum CRFilterType : Int {
    case ScrubQuery
    case Blacklist
    case PreserveQuery
}
CRFilterTypeScrubQuery Deprecated
CRFilterTypeBlacklist Blacklist certain endpoints. Request with a URL that match this string are not reported
CRFilterTypePreserveQuery Prevent URL query string from being stripped out
CRFilterTypePreserveFragment Prevent URL fragment identifier from being stripped out
CRFilterTypePreserveParameters Prevent URL parameter string from being stripped out
CRFilterTypePreserveAll Prevent URL query, fragment, and parameters sections from being stripped out