---
title: "__samplerName"
description: "JMeter __samplerName function reference: syntax, parameters, and practical examples for parameterizing test plans with dynamic values."
url: https://docs.jmeter.ai/functions/samplername/
lastUpdated: 2026-10-01
source: docs.jmeter.ai
---

# __samplerName

*Also documented in context in the [full Functions and Variables reference](/user-manual/functions/#__samplerName).*

The samplerName function returns the name (i.e. label) of the current sampler.

The function does not work in Test elements that don’t have an associated sampler.
For example the Test Plan.
Configuration elements also don’t have an associated sampler.
However some Configuration elements are referenced directly by samplers, such as the HTTP Header Manager
and Http Cookie Manager, and in this case the functions are resolved in the context of the Http Sampler.
Pre-Processors, Post-Processors and Assertions always have an associated Sampler.

Example:

```bash
\${__samplerName()}
```

| Name | Required | Description |
| --- | --- | --- |
| Variable Name | No | A reference name - `refName` - for reusing the value created by this function. Stored values are of the form `\${refName}`. |

## Related

- [Functions and Variables Guide](/topics/functions-and-variables/)
- [Regex Extractor Builder](/tools/regex-tester/)
- [Full Functions Reference](/user-manual/functions/)
- [Component Reference](/user-manual/component-reference/)
