# Custom queries and reference for the Tag Events Explore

Use the Tag Events Explore to see information about adding and removing tags to/from your audience.

Access history related to [Tag](https://www.airship.com/docs/reference/glossary/#tag) adds and removals, get Tag values at the time of Tag-related events, and get information about channels associated with specific Tags and/or Tag events.

<p>Data availability depends on your <a href="https://www.airship.com/docs/reference/feature-packages/#data">Performance Analytics plan</a>.</p>

## Navigation

To access the Explore:

1. Go to **Reports**, then **Performance Analytics**.
1. Select the folder icon (), then **Shared**.
1. Under **Looks**, select **Explore Glossary** (**Explore Glossary EUCS** for EU customers).
1. Select **Tag Events**, then **Navigate to Explore**.

<p>For a list of all Explores in the glossary, see <a href="https://www.airship.com/docs/guides/reports/analytics/exploring/exploring/#predefined-explores">Predefined Explores</a> in <em>Exploring Performance Analytics data</em>.</p>

## Field categories

<p>The sidebar lists categories for various filters, [Dimensions](https://www.airship.com/docs/reference/glossary/#pa_dimension), and [Measures](https://www.airship.com/docs/reference/glossary/#pa_measure) you can use to explore your data. To see their definitions, hover over an item, then select the info icon ().</p>

Field categories in the Tag Events Explore:

| Category | Description |
| --- | --- |
| **Query Parameters** | Target all or specific projects, and specify dates and response windows, where relevant. |
| **Tag Events** | Set Tag parameters for the query. |
| **Tags Current** | Get Tag values associated with the channels at the time the report is run. |
| **Tags Relative** | Get Tag values associated with the channels at the time the filtered Tag event occurred. |
| **User Detail** | Get information about the channel that performed the filtered event. |
| **User Detail - Derived** | Get historical information about the channel that performed the filtered event. |
{class="table-col-1-20"}

### Default filters

<p>Use filters to reduce the number of records scanned and results returned. Each Explore includes filters that cannot be removed from the query.</p>

The filter name, [field category](#field-categories), and usage information for the default filters in the Tag Events Explore:

| Filter name | Field category | Use the filter to... |
|-------------|----------------|----------------------|
| **Current Project Only** | Query Parameters | Determine which projects are included in the query. Default: **Yes**. To include other projects, 1) select **No**, 2) in the sidebar, select **Query Parameters**, 3) under **Dimensions**, select the filter icon () next to **Project name**, and 4) in the Filters section, choose which projects to include. |
| **Date Range** | Query Parameters | Target events that occurred on a specific date or within a specific date range. |
| **Tag Action Filter** | Tag Events | Return Tags that were set, removed, or either. Use with operator **is**. Select one of: **Add**, **Delete**, **All**. |
| **Tag Group Filter** | Tag Events | Specify the [Tag Group](https://www.airship.com/docs/reference/glossary/#tag_group) you want to return tags for. Default: **Notification Opt-in**. Must not be empty. Use with operator **is equal to**. |
| **Tag Name Filter** | Tag Events | Return results for specific Tags. Enter Tags by name. Default value: **false**. Default operator: **is equal to**. To return all possible Tags for the filtered Tag Group, select the operator **is not null**. |
{class="table-col-1-20 table-col-2-20"}

The Tag Action, Group, and Name Filters include non-matched (null) records. To return matched records only, add the Tag Action, Tag Group, and Tag Name Dimensions from the Tag Events field category.

## Building custom queries

The following sections walk you through using the Tag Events Explore to create custom queries that answer:

* How can I get a list of all the Tags available under a specific Tag Group? How many users had these Tags added over the past 30 days? 
* How can I get a list of users that had a Tag added after interacting with a button in an [In-App Automation](https://www.airship.com/docs/reference/glossary/#iaa)?

### Get Tags in a Tag Group

Follow these steps to get a list of Tags in a Tag Group and the number of users who had the Tag set over the past 30 days. We only need to use the default filters.

> **Note:** * This report does not return whether or not users still have the Tag set. To return that data, use the [Audience with Attributes Explore](https://www.airship.com/docs/guides/reports/analytics/exploring/exploring/#predefined-explores).
> * If a Tag does not appear for selection in Performance Analytics, it means that no add or remove event has occurred for the Tag during the specified time range.


First, [open the Tag Events explore](#navigation), and then configure your query:

1. Set up the filters:
   1. Leave **Current Project Only** set to `is Yes`.
   1. Set **Date Range** to `is in the last 30 complete days`.
   1. Leave **Tag Action** set to `Add`.
   1. Set **Tag Group** to the Tag Group you want to return Tags for.
   1. Set the **Tag Name** operator to `is not null`.

1. In the sidebar, specify the value and measurement to display:
   1. Select **Tag Events**, then select the Dimension **Tag Name**.
   1. Select **User Detail**, then select the Measure **User Count**.  
   
<p>Now you are ready to get your data. Select <strong>Run</strong>, and you should see results similar to the below image. To save your custom query for later access, follow the steps in <a href="https://www.airship.com/docs/guides/reports/analytics/tasks-queries/saving-queries/">Saving Performance Analytics queries</a>.</p>

![Creating a custom query from the Tag Events Explore](https://www.airship.com/docs/images/explore-tag-events-custom-tags-list_hu_f0f686448d535356.webp)

*Creating a custom query from the Tag Events Explore*

### Get Tag adds for button interaction

Follow these steps to get a list of users that had a Tag added after interacting with a button in an [In-App Automation](https://www.airship.com/docs/reference/glossary/#iaa). We only need to use the default filters. You must know the name of the Tag for the button interaction. Users will be identified by [Channel ID](https://www.airship.com/docs/reference/glossary/#channel_id).

First, [open the Tag Events explore](#navigation), and then configure your query:

1. Set up the filters:
   1. Leave **Current Project Only** set to `is Yes`.
   1. Set **Date Range** to a range that makes sense for your query.
   1. Leave **Tag Action** set to `is Add`.
   1. Set **Tag Group** to the Tag Group containing the Tag you want results for.
   1. Set the **Tag Name** operator to `is equal to` and select the Tag associated with the button interaction.

1. In the sidebar, specify the value and measurement to display:
   1. Select **Tag Events**, then select the Dimension **Tag Name**.
   1. Select **User Detail**, then select the Dimension **Channel ID** and Measure **User Count**. If you're using [Named Users](https://www.airship.com/docs/reference/glossary/#named_user) in your project, you can also add the Dimension **Named User** to identify these users in your database. 
   
Now you are ready to get your data. Select **Run**, and you should see results similar to the below image. To get count of users, select **Totals** in the **Data** header. To save your custom query for later access, follow the steps in [Saving Performance Analytics queries](https://www.airship.com/docs/guides/reports/analytics/tasks-queries/saving-queries/).
 
![Creating a custom query from the Tag Events Explore](https://www.airship.com/docs/images/explore-tag-events-custom-tag-adds-button_hu_1abce13465c0fc4a.webp)

*Creating a custom query from the Tag Events Explore*