# Scrutinizing the results of a campaign with NQL

{% hint style="warning" %}
Refer to the [Launching campaign programs](https://docs.nexthink.com/platform/user-guide/campaigns/managing-campaigns/launching-campaign-programs) documentation for guidelines on planning, gaining approval, testing and launching your campaign within your organization.
{% endhint %}

After you publish a campaign, targeted employees start answering the campaign questions. Create Nexthink Query Language (NQL) investigations to see how employees interacted with the campaign and answered questions.

## Viewing the results of a campaign in Investigations <a href="#scrutinizingtheresultsofacampaignwithnql-viewingtheresultsofacampaignininvestigations" id="scrutinizingtheresultsofacampaignwithnql-viewingtheresultsofacampaignininvestigations"></a>

{% hint style="info" %}
The results of campaigns triggered by remote actions are only available locally during the execution of a remote action screen. Consequently, remote action campaigns have no response data available on the Campaign details page.
{% endhint %}

* Select **Campaigns** from the main menu.
* Select a campaign listed in the navigation panel to view more details. The navigation panel shows published and retired campaigns.
* Select **Campaign overview** from the navigation panel to view all published and retired campaigns and their statistics.

Campaign dashboards and campaign result exports do not include user names. This hides respondents' identities from users without Investigation rights, such as stakeholders who have access only to this page.

Users with Investigation rights can access campaign results in Investigations, where responses can be analyzed together with user and device characteristics for deeper analysis.

Refer to the [monitoring-specific-campaign-responses](https://docs.nexthink.com/platform/user-guide/campaigns/working-with-campaigns/monitoring-specific-campaign-responses "mention") documentation for more information.

<figure><img src="https://268444917-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxJSUDk9NTtCHYPG5EWs3%2Fuploads%2FBZDTlbbJNGQUM11Odbya%2FCamapign_details_8928372a9.png?alt=media&#x26;token=ae231e0d-91da-41b4-8958-9c419abc802e" alt=""><figcaption></figcaption></figure>

On the Campaigns details page, click on the action menu at the top right corner of the page and select **Investigate** to open the Investigations page with a prewritten query to generate results for campaign responses, including:

* User information.
* Response state and state details.
* Answers to each question and free-text comments where applicable.
* Values of the parameters in case the campaign is parametric.

On the Investigations page, you can refine the NQL query to adjust the columns or filter the results according to your requirements.

## Querying campaign information and results with NQL <a href="#scrutinizingtheresultsofacampaignwithnql-queryingcampaigninformationandresultswithnql" id="scrutinizingtheresultsofacampaignwithnql-queryingcampaigninformationandresultswithnql"></a>

Using NQL, you can access key information regarding your campaign and their responses querying the following tables:

* `campaign.campaigns` contains the basic information about all campaigns with a published or retired state.
* `campaign.responses` contains details of every campaign response, given or expected. Use it when you need to gather statistics across campaigns but do not need to inspect campaign-specific data, such as answers to questions or parameter values.
* For each campaign (after the campaign is published), a dynamic table `campaign.nql_id_of_the_campaign.responses` is available to inspect the responses of that particular campaign, for example, `campaign.#my_campaign.responses` or `campaign.dex_score_campaign.responses`. In addition to the fields available in the table `campaign.responses`, the dynamic data model table of a campaign includes fields with answers to each question and, if the campaign is parametric, values of each parameter.

Refer to the [NQL data model](https://docs.nexthink.com/platform/understanding-key-data-platform-concepts/nql-data-model) page for the full list of fields.

If a user is targeted several times by the same campaign, then each occurrence corresponds to a different response. If you need to access only the last answer of a user to a campaign, you can leverage the `last` NQL operator. Refer to the [NQL syntax](https://docs.nexthink.com/platform/understanding-key-data-platform-concepts/nexthink-query-language-nql/nql-operators/nql-syntax-operators) for details and the [query examples](https://docs.nexthink.com/platform/user-guide/campaigns/campaigns-nql-capabilities/campaigns-nql-examples).

## Inspecting answers and parameters using the dynamic data model <a href="#scrutinizingtheresultsofacampaignwithnql-inspectinganswersandparametersusingthedynamicdatamodel" id="scrutinizingtheresultsofacampaignwithnql-inspectinganswersandparametersusingthedynamicdatamodel"></a>

The dynamic data model provides fields per question to gather details about the employees' answers. The question identifier NQL uses corresponds to the question ID defined in the campaign. When using Campaigns (Classic), the question identifiers are based on the question order, for example, `#1` and `#2`.

The available fields correspond to the type of question:

* For single-answer questions, you can get the answer label the employee selected using `answers.question_id.label`.
* For multiple-answer questions, you can get the list of the answer labels selected by the employee using `answers.question_id.labels`.
* For opinion scale questions, you can get the answer label the employee selected using `answers.question_id.label` and its associated value with `answers.question_id.value`. The value is the name of the answer selected, followed by the numerical value attributed to the answer between parentheses.
* For NPS questions, you can get the details of the selected choice in different ways using `answers.question_id.value` (numeric values from 0 to 10), `answers.question_id.category` (either promoter, passive, or detractor) and `answers.question_id.label` (ranging from detractor with 0 to promoter with 10).

In addition, for all question types, you can access the optional free text comment using `answers.question_id.comment` and know the question type using `answers.question_id.type`.

For parametric campaigns, you can access the value of the parameters specified at the time of triggering the campaign, using `parameters.parameter_id`.

## Response state <a href="#scrutinizingtheresultsofacampaignwithnql-responsestate" id="scrutinizingtheresultsofacampaignwithnql-responsestate"></a>

The state of a response informs about the delivery status of the campaign, the employee interactions with it, and the employee answers to the campaign question. The field `state` and `state_details` in the `responses` tables reflect the current state of a response. The historized state information is available using the `historical_state`, `historical_state_details` and `historical_time` fields.

Find below the details of the different states for a response.

| State    | State Details          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| -------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Planned  | Not applicable         | <p>The employee was online on a device at the time the campaign was triggered, and the campaign is ready to be displayed as soon as the employee’s device is able to do so, taking into consideration the <a href="../managing-campaigns/creating-campaigns/limiting-the-reception-rate-of-campaigns">employee protection rules</a>.</p><p>The state details field is not applicable in this case, as there are no variations for this state.</p> |
| Targeted | Offline                | The employee was offline at the time the campaign was triggered.                                                                                                                                                                                                                                                                                                                                                                                  |
| Targeted | Delayed                | The campaign has not been delivered yet because it arrived during an interval that protects the user from bursts of campaigns ([DNDP, NNPP](https://docs.nexthink.com/platform/user-guide/campaigns/managing-campaigns/creating-campaigns/limiting-the-reception-rate-of-campaigns)). The employee receives the campaign once the protection period has elapsed.                                                                                  |
| Targeted | Postponed              | The user clicked the *remind me later* option to postpone the campaign The default reminder frequency is twice a day.                                                                                                                                                                                                                                                                                                                             |
| Targeted | Notified               | The user has been presented with the campaign, in a semi-collapsed way or fully open, depending on the content size of the first question.                                                                                                                                                                                                                                                                                                        |
| Targeted | Opened                 | The user was presented with a campaign and opened it from a semi-collapsed state, meaning the user saw the first question in full. When the question appears non-collapsed, the state directly updates from *notified* to the *opened* one.                                                                                                                                                                                                       |
| Declined | Not applicable         | The employee declined to answer​. The state details field is not applicable in that case, as there are no variations for this state.                                                                                                                                                                                                                                                                                                              |
| Answered | Partially              | The employee only answered part of the questions.                                                                                                                                                                                                                                                                                                                                                                                                 |
| Answered | Fully                  | The employee answered all the questions.                                                                                                                                                                                                                                                                                                                                                                                                          |
| Canceled | Canceled               | Event canceled by scheduler rules for a technical reason, such as the employee or device no longer exists.                                                                                                                                                                                                                                                                                                                                        |
| Canceled | User not found         | The system is not able to find the employee associated with the SID provided.                                                                                                                                                                                                                                                                                                                                                                     |
| Canceled | Expired                | <p>The request targeting the employee was sent and not answered or declined within the standard expiry time.</p><p>Requests expire by default after one year. The expiration can only be modified when triggering campaigns using the API.</p>                                                                                                                                                                                                    |
| Canceled | Already pending        | The employee already has a pending response for the same campaign (not answered nor declined yet) and, in case of a parametric campaign, with the same parameter values, when re-targeted manually or via API. The system canceled the request to avoid double notifications.                                                                                                                                                                     |
| Canceled | Collector incompatible | This state is set by Nexthink Collector if it is targeted with a campaign containing incompatible features.                                                                                                                                                                                                                                                                                                                                       |
| Retired  | Not applicable         | <p>The campaign is retired and the response was not in a final state (answered, declined or cancelled).</p><p>The state details field is not applicable in that case, as there are no variations for this state.</p>                                                                                                                                                                                                                              |
| Unknown  | Not applicable         | The campaign did not target the employee or the employee did not receive the notification, either because of problems communicating with the employee’s device or because the device is turned off. The state details field is not applicable in this case, as there are no variations for that state.                                                                                                                                            |

***

RELATED TOPICS

* [monitoring-specific-campaign-responses](https://docs.nexthink.com/platform/user-guide/campaigns/working-with-campaigns/monitoring-specific-campaign-responses "mention")
* [Campaigns NQL examples](https://docs.nexthink.com/platform/user-guide/campaigns/campaigns-nql-capabilities/campaigns-nql-examples)
