# Custom queries and reference for the Device Events Explore

Use the Device Events Explore to get data related to device activity.

You can get detailed metrics for these default events: App Session, Install, Uninstall, Web Session, SMS First Opt-In, and Email First Opt-In.

<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 **Device 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 &ldquo;i&rdquo; icon (
).</p>

Field categories in the Device Events Explore:

<div class="table-scroll-wrapper">
<table width="100%" class="reference-table">
  <col style="width:20%">
  <col style="width:80%">
<thead>
  <tr>
    <th>Category</th>
    <th>Description</th>
   </tr>
</thead>
<tbody>
  <tr><td>Attributes Current</td>
<td>Get Attribute values associated with the channels at the time the report is run.</td></tr>
  <tr>
    <td>Attributes Relative</td>
    <td>Get Attribute values associated with the channels at the time filtered event occurred.</td>
  </tr>
  <tr>
    <td>Device Events</td>
    <td>Set device event parameters for the query.</td>
  </tr>
  <tr><td>Device Properties Current</td>
<td>Get device property values associated with the channels at the time the report is run.</td></tr>
  <tr>
    <td>Device Properties Relative</td>
    <td>Get device property values associated with the channels at the time filtered event occurred.</td>
  </tr>
  <tr><td>Query Parameters</td>
<td>Target all or specific projects, and specify dates and response windows, where relevant.</td></tr>
  <tr><td>Tags Current</td>
<td>Get Tag values associated with the channels at the time the report is run.</td></tr>
  <tr>
    <td>Tags Relative</td>
    <td>Get Tag values associated with the channels at the time filtered event occurred.</td>
  </tr>
  <tr><td>User Detail</td>
<td>Get information about the channel that performed the filtered event.</td></tr>
  <tr><td>User Detail - Derived</td>
<td>Get historical information about the channel that performed the filtered event.</td></tr>
</tbody>
</table>
</div>

### 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 Device Events Explore:

<div class="table-scroll-wrapper">
<table width="100%" class="reference-table">
  <col style="width:20%">
  <col style="width:20%">
  <col style="width:60%">
<thead>
  <tr>
    <th>Filter name</th>
    <th>Field category</th>
    <th>Use the filter to...</th>
  </tr>
</thead>
<tbody>
  <tr><td>Current Project Only</td>
<td>Query Parameters</td>
<td>
  Determine which projects are included in the query. Default selection: <b>Yes</b>. To include other projects within your company, select <b>No</b>, then:
    <ol>
      <li>
        In the sidebar, select <b>Query Parameters</b>.
      </li>
      <li>
        Under <b>Dimensions</b>, select the filter icon (
) next to <b>Project name</b>.
      </li>
      <li>In the Filters section, select the entry field next to the Project Name filter and choose which projects to include.
      </li>
    </ol>
</td></tr>
  <tr><td>Date Range</td>
<td>Query Parameters</td>
<td>Target events that occurred on a specific date or within a specific date range.</td></tr>
  <tr>
    <td>Event Type Filter</td>
    <td>Device Events</td>
    <td>Return results for a specific event type. Default selection: <b>App Session</b>. Other possible selections: <b>Install</b>, <b>Uninstall</b>, <b>Web Session</b>, <b>SMS First Opt-In</b>, <b>Email First Opt-In</b>, or <b>All</b>.</td>
  </tr>
</tbody>
</table>
</div>

## Building custom queries

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

* How can I get install and uninstall counts? 
* How can I determine the hour of the day when my users are the most active? 

### Get install and uninstall counts

Follow these steps to get the number of install and uninstall events over the past 30 days.

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

1. Set up the filters:
   1. Set **Event Type Filter** to `is All`.
   1. Leave **Current Project Only** set to `is Yes`.
   1. Set **Date Range** to `is in the last 30 complete days`.

1. In the sidebar, specify values and measures to display:
   1. Select **Device Events**, then the Dimension **Event Date**, then **Date**.
   1. Also in **Device Events**, select the Measures **Install Count** and **Uninstall Count**.

1. Select the **Line** visualization format to display the report as a line graph.

<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 Device Events Explore](https://www.airship.com/docs/images/explore-device-events-custom-install-uninstall_hu_8a09fbb311625a18.webp)

*Creating a custom query from the Device Events Explore*

### Find the most active hour

Follow these steps to determine the hour of the day when your users are the most active.

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

1. Set up the filters:
   1. Leave **Event Type Filter** set to `is App Session`.
   1. Leave **Current Project Only** set to `is Yes`.
   1. Set **Date Range** to `is in the last 30 complete days`.

1. In the sidebar, specify values and measures to display:
   1. Select **Device Events**, then the Dimension **Event Date**, then **Hour of Day**.
   1. Also in **Device Events**, select the Measure **App Session Count**.

1. Select the **Column** visualization format to display the report as a column chart / bar graph.

<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 Device Events Explore](https://www.airship.com/docs/images/explore-device-events-custom-active-hour_hu_e58eaa5b8cc9cc9a.webp)

*Creating a custom query from the Device Events Explore*
