Scheduling recurring campaign

One of the critical aspects of any recurring sentiment campaign configuration is targeting employees with optimized frequency, which ensures balanced and consistent data sampling, without overusing employee willingness to respond.

A recurring campaign is a scheduled campaign configured with the Again after option in the Schedule tab of the Edit campaign page. Once published, the campaign automatically re-evaluates its NQL query every hour and targets employees accordingly each time the query is executed.

This page guides you through the process of building the correct NQL query and setting appropriate campaign properties, to:

  • Target the right users

  • Maintain a balanced sample size

  • Optimize when employees are surveyed

Setting up a campaign

Create a campaign and set the Trigger method to Schedule.

Entering an NQL query for targeting users

Before you enter the Targeting query on the Schedule tab of the campaign configuration page, save the campaign at least once. This ensures the system recognizes your campaign and avoids a Table does not exist error during NQL query validation.

The following steps guide you through building a query to identify the target users for your campaign.

1

Target active employees

  • Start your query with a users table.

  • Add session.events to remove inactive user accounts and to allow for applying additional filters based on fields not available in the users namespace, such as device type or specific event attributes.

users
| with session.events during past 30d
| where device.hardware.type in [laptop, desktop, virtual]
...
2

Exclude certain users

The best criteria depend on your environment and Entra-ID integration.

Exclude non-human users

Exclude any non-human users from your query. The optimal method for identifying and excluding non-human users varies by environment.

...
| where user.name !in ["*localadmin*"] 
| where user.name !in ["*datadog*", "*newrelic*"] 
| where user.name !in ["*testing*"] 
| where user.upn != null 
| where user.upn in ["*@mycompany.com", "*@ext.mycompany.com"] 
| where user.ad.email_address != null 
...

Exclude users you don't want to survey

Exclude users who should not be surveyed, such as VIPs, users from specific countries, or those with certain roles.

Consider the following examples:

...
| where user.name !in ["*datadog*", "*newrelic*"] 
| where user.ad.distinguished_name !in ["*any_substring*", "*any_substring*"] 
| where user.ad.country_code !in ["DE", "FR"] 
| where user.ad.department !in ["Facility Management", "Legal"] 
| where user.ad.job_title !in ["C?O", "*Director*", "VP"] 
| where #custom_field_isVIP != "yes"
...
3

Determine the size of your population

Run your query to determine the total number of employees you can target, your population size.

4

Adjust the timeframe

When determining the population size, you have used a longer timeframe to include more employees (e.g., those on holiday or sick leave). For actual targeting, use a shorter timespan to focus on employees who are active and able to respond in a timely manner.

Narrow the dataset to those who have performed at least one action on a device in the past 7 days.

users during past 7d
| with session.events past 7d  
...
5

Compute how often users have already responded

Join the campaign.responses table and compute the number of times each user has already received the campaign this year. Adjust the campaign.nql_id to the NQL ID in the General tab of the Edit campaign page.

| include campaign.responses during past 365d 
| where campaign.nql_id == "YOUR_CAMPAIGN_ID" 
| where campaign.response.state in [targeted, answered, declined] 
| compute times_targeted_past_365d = count() 
6

List fields for visibility

Optionally, output some information about the users, in case you want to run this query as an investigation to inspect the results.

| list times_targeted_past_365d, sid, uid, name, type, upn, user.ad.full_name, user.ad.email_address, user.ad.job_title, ad.office, user.ad.department, ad.city, ad.country_code, ad.organizational_unit, first_seen, ad.distinguished_name 
7

Sort by number of campaign responses

Sort your results by the number of times each employee responded to the campaign, to bubble up the people with the fewest responses. This ensures that they get the survey before someone else gets it a second time.

| sort times_targeted_past_365d asc 
8

Randomize results

Pseudo-randomize the resulting list by sorting by UID.

| sort uid asc 
9

Limit to the number of users that you can target each hour

Determine the number of users that you can target each hour and include this value in the | limit clause at the end of your query.

| limit <number of users to target each hour>

The number of users to target upon each query execution depends on:

It also results from the number of times the query is executed throughout a year. By design, a recurring campaign executes the NQL query and targets the returned users every hour, that is 8760 times per year:

365days×24hours=8760365 \,\text{days} \times 24 \,\text{hours} = 8760

Population size of greater or equal to 10 000 employees

If your population exceeds 10 000 employees, use the following formula to determine the number of users to target upon each query execution.

Number of users to target each hour=Population size×Times targeted per year8760 \text{Number of users to target each hour} = \frac{\text{Population size}\times \text{Times targeted per year}}{8760}

To reserve a margin and avoid running out of targetable users before the end of the 365-day period, round the result down to the next smaller integer and use this number as the value in the | limit clause at the end of your campaign NQL query.

Example

Consider an organization with a population of 20 000 employees available for DEX campaigns, where each employee may be targeted no more than once every 365 days.

200008760=2.28 \frac{20000}{8760} = 2.28

Based on the results, you should target 2 users per hour, by limiting the number of results returned by your targeting query to | limit 2.

Population size of less than 10 000 employees

If your population is fewer than 10 000, Nexthink recommends targeting one user per hour. This approach helps optimize the frequency at which employees receive the campaign while preventing the pool of eligible respondents from being exhausted.

Make sure you further adjust the frequency of the campaign being sent to a single employee. See the Scheduling recurring campaign section on this page.

The final query should look like the example below. Copy it, replace the placeholders with your data, and insert in the sentiment campaign definition.

users during past 7d 
| with session.events during past 7d
| where device.hardware.type in [laptop, desktop]
| where <CONDITIONS_TO_EXCLUDE_NON-HUMAN_USERS>
| where <CONDITIONS_TO_EXCLUDE_SPECIFIC_USERS> 
| include campaign.responses during past 365d 
| where campaign.nql_id == "<YOUR_CAMPAIGN_ID> " 
| where campaign.response.state in [targeted, answered, declined] 
| compute times_targeted_past_365d = count() 
| list times_targeted_past_365d, sid, uid, name, type, upn, user.ad.full_name, user.ad.email_address, user.ad.job_title, ad.office, user.ad.department, ad.city, ad.country_code, ad.organizational_unit, first_seen, ad.distinguished_name 
| sort times_targeted_past_365d asc 
| sort uid asc
| limit <NUMBER_OF_USERS_TO_TARGET_EACH_HOUR>

Setting the period after which users may be targeted again

To make the campaign recurring, go to the Schedule tab and set Target employees will receive the campaign to Again after, then specify the desired interval.

The frequency of sending sentiment campaigns to employees depends on your population size.

Population size of greater or equal to 10 000 employees

For larger organizations, Nexthink recommends targeting every user not more than once per year, as a starting point. Set the Again after interval to 12 months to ensure each user is targeted not more frequently than once a year.

More frequent data collection doesn't significantly improve precision or consistency on its own. According to probability theory, the key factor is the sample size—the number of employees surveyed—rather than its proportion to the overall population. However, increasing the frequency is recommended when you need to segment results further, such as by country or department, to ensure sufficient sample size within each subgroup.

To maximize the value of user feedback, leverage employees’ willingness to respond to occasional surveys to explore new areas or gain deeper insights into identified topics.

Population size of less than 10 000 employees

Smaller organizations with fewer than 10 000 employees usually need to allow for more frequent targeting of users to ensure continuous data collection. In such a case, you must compute the period after which you can target the same user. This ensures:

  • You do not run out of respondents.

  • Employees do not receive the campaign too often.

Assuming your query targets one user per hour (as explained in Step 9: Limit to the number of users that you can target each hour), use the following formula to get the number in months:

  • Divide the Population size by the number of hours in the day and number of days in the month (on average):

Population size24h×30days \frac{\text{Population size}}{24 \,\text{h} \times 30 \,\text{days}}

Set the Again after interval to the number of months, which is lower than the number you obtain from the formula.

Example:

Consider the example introduced earlier, where an organization with 6000 employees targets one employee per hour.

600024h×30days8.3 \frac{6000}{24 \,\text{h} \times 30 \,\text{days}} \approx 8.3

After 8.3 months, all employees will have been targeted. To avoid gaps in the collected data, the Again after interval should be set to 8 months or less.


After completing all the settings in the Schedule tab, save and publish your campaign to activate hourly user targeting.

Last updated

Was this helpful?