HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In


You can use the APIs to remove statistical data and to prevent the addition of personally identifiable information (PII) to the search index. For example, you can prevent data that contains an at sign (@) from being indexed.

This feature involves the following APIs.

**Method****Description****Sample**
StatisticsGetGDPRSearch GDPR data from statistics. Use to get statistics items that match a query pattern. <br>An extension method of IStatisticsClient.public static GDPRQueryResult StatisticGetGDPR(this IStatisticsClient client, string query)
StatisticsDeleteGDPRDelete GDPR data from statistics. Used to delete all statistics items that match the query pattern. <br>An extension method of IStatisticsClient.public static GDPRDeleteResult StatisticDeleteGDPR(this IStatisticsClient client, string query)

In addition, you can use these APIs to prevent PII data from appearing in search query results.

### ITrackSanitizerPatternRepository

**Method****Description****Sample**
AddAdd patterns to storage which, in turn, are used to prevent PII data from search query.string Add(TrackSanitizerPattern pattern)<br>void Add(IEnumerable<TrackSanitizerPattern> patterns)
GetGet pattern by Pattern Id from storageTrackSanitizerPattern Get(string patternId)
GetAllGet all patterns from storageIEnumerable<TrackSanitizerPattern> GetAll()
UpdateUpdate existing pattern(s)string Update(TrackSanitizerPattern pattern)<br><br>void Update(IEnumerable<TrackSanitizerPattern> patterns)
DeleteDelete pattern by Id from storagevoid Delete(string patternId)
DeleteAllDelete all patterns from storagevoid DeleteAll()

See also [Prevent indexing of PII data](🔗).

### Examples

To retrieve and remove PII data from statistics, you can search for a range of data:

  • Email including domain name, for example "[email protected]"

  • Full name, for example "John Doe"

You can prevent sensitive data in a custom search query from being saved to the statistics using a predefined pattern.



When using a wildcard pattern, review these [Microsoft wildcard samples](🔗).

## Search, filter, and delete PII data

Use statistics#Search\_filter\_delete, see [Prevent indexing of PII data](🔗) how to install a sample and verify the deletion.