CRFilter

By default, Workspace ONE Intelligence SDK reports Network Insights data for all URLs that are accessed by your app and strips 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 denylists that will completely discard matching URLs. Network Insights data that pertains to any URL that matches the deny URL will not be reported to Workspace ONE Intelligence.

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

Objective-C

// 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

// 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 deny filter.

Objective-C

+ (CRFilter *)filterWithString:(NSString *)matchToken;

Swift

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.

Objective-C

+ (CRFilter *)queryPreservingFilterWithString:(NSString *)matchToken

Swift

class func queryPreservingFilterWithString(matchToken: String)

matchToken

An NSString of the url to filter

- initWithString:

Initialize a filter that denies reporting of all URLs that match the specified token.

Objective-C

- (id)initWithString:(NSString *)matchToken;

Swift

init?(string matchToken: String)

matchToken

An NSString of the url to filter

A CRFilter object of type CRFilterTypeDeny

- initWithString:andFilterType:

Initialize a filter that denies reporting for all URLs that match the specified token.

Objective-C

- (id)initWithString:(NSString *)matchToken
       andFilterType:(CRFilterType)filterType;

Swift

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.

Objective-C

+ (NSString *)applyFilter:(CRFilterType)filterType
                    ToURL:(NSString *)url;

Swift

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 deny filter is specified.

Constants

CRFilterType

The filter type of CRFilter

Objective-C

typedef enum : NSInteger {
   CRFilterTypeScrubQuery,
   CRFilterTypeDeny,
   CRFilterTypePreserveQuery,
   CRFilterTypePreserveFragment,
   CRFilterTypePreserveParameters,
   CRFilterTypePreserveAll
} UIApplicationState;

Swift

enum CRFilterType : Int {
    case ScrubQuery
    case Deny
    case PreserveQuery
    case PreserveFragment
    case PreserveParameters
    case PreserveAll
}

CRFilterTypeScrubQuery

Deprecated

CRFilterTypeDeny

Deny reporting for certain endpoints. Request with a URL that matches 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