---
title: "How to sample users for tracking using API"
slug: "how-to-sample-users-for-tracking-using-api"
updated: 2026-11-23T12:30:19Z
published: 2026-11-23T12:30:19Z
canonical: "support.gainsight.com/how-to-sample-users-for-tracking-using-api"
---
> ## Documentation Index
> Fetch the complete documentation index at: https://support.gainsight.com/llms.txt
> Use this file to discover all available pages before exploring further.
# How to sample users for tracking using API
This article explains how to use the Gainsight PX tag to sample users.
## Sampling User Traffic
Sampling is useful when there are certain types of users you don't wish to track and you would like to reduce tracking volumes while leveraging sampling strategy to gain behavioral insights.
> If you wish to track 100% of the traffic and wish to sample engagements please use the [scheduling and scoping](/v1/docs/in-app-engagement-qualification-scope) step in Gainsight PX engagement editor.
Sampling can be done by wrapping Gainsight PX tag and using a sampling utility function. You must set the right Product key before using the below code.
```plaintext
```