# Label provider

Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fuser-guides%2Frum%2Fsdk-features%2Flabel-provider.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fuser-guides%2Frum%2Fsdk-features%2Flabel-provider.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

The RUM Browser SDK captures RUM logs and events and populates their main attributes. **Label** **Provider** gives you access to every event or URL collected by the RUM SDK, allowing you to add labels using custom-defined functions and then easily filter and aggregate your data once ingested by Coralogix.

## Overview[​](#overview "Direct link to Overview")

Take advantage of Label Provider to:

* Add labels to an event based on the event data or its network or page URLs

* Filter data easily once ingested by Coralogix

* Unleash feature mapping to streamline investigation and troubleshooting

For instance, attach a `team-APM` label to each event on your APM page. This allows your team to track and examine only the events relevant to them.

## Configuration[​](#configuration "Direct link to Configuration")

```
import { CoralogixRum } from '@coralogix/browser';



const featurePageUrlLabelProvider = new UrlBasedLabelProvider({

  urlType: UrlType.PAGE,

  urlPatterns: [

    {

      regexps: [/apm/],

      labels: { featureGroupId: 'apm' },

    },

  ],

  defaultLabels: {

    featureGroupId: 'unknown-feature-group',

  },

});



const regularExpErrorLabelProvider: GenericLabelProvider = {

  providerFunc: (url, event) => {

    if (event.error_context?.error_message?.includes('Invalid regular expression')) {

      return {

        regular_expression_error: 'true',

      };

    }



    return {};

  },

};



CoralogixRum.init({

  // ...

  labelProviders: [

    featurePageUrlLabelProvider,

    regularExpErrorLabelProvider

  ]

});
```

## Filter with labels[​](#filter-with-labels "Direct link to Filter with labels")

Once you’ve configured your labels, use them to filter your data and enjoy feature mapping in any of our RUM products.
