> For the complete documentation index, see [llms.txt](https://docs.hackle.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hackle.io/development-guide/sdk/user-identifier/server-user-identifier.md).

# 서버 사용자 식별자

서버에서는 사용자를 특정할 수 없기 때문에 **항상 사용자 지정 식별자를 파라미터로 전달**해야 합니다.

```java
// 테스트 그룹 분배
long experimentKey = 42L;
User user = User.builder().userId("ae2182e0");
Variation variation = hackleClient.variation(experimentKey, user);

// 사용자 이벤트 전송
hackleClient.track("purchase", user);
```

```python
# 테스트 그룹 분배
uesr = Hackle.user(user_id='ae2182e0')
variation = hackle_client.variation(experiment_key=42, user=user)

# 사용자 이벤트 전송
event = Hackle.event(key='purchase')
hackle_client.track(event=event, user=user)
```

```javascript
// 테스트 그룹 분배
const experimentKey = 42;
const user = { userId: "ae2182e0" };
hackleClient.variation(experimentKey, user);

// 사용자 이벤트 전송
hackleClient.track("purchase", user);
```

```php
// 테스트 그룹 분배
$experimentKey = 42;
$userId = 'ae2182e0'
$user = \Hackle\Common\HackleUser::builder()->userId($userId)->build();
$variation = $hackleClient->variation($experimentKey, $user);

// 사용자 이벤트 전송
$hackleClient->track('purchase', $user);
```

```ruby
# 테스트 그룹 분배
user = Hackle.user(user_id: 'ae2182e0')
variation = hackle_client.variation(experiment_key: 42, user: user)

# 사용자 이벤트 전송
event = Hackle.event(key: 'purchase')
hackle_client.track(event: event, user: user)
```

## 클라이언트, 서버 간 식별자 맞추기

클라이언트, 서버 SDK 를 동시에 사용하는 경우 각 환경에서 동일한 유저에 대해서 동일한 식별자로 맞추어 하여 사용할 수 있습니다.

이러한 경우에는 클라이언트, 서버간 API 통신시에 아래와 같이 HTTP 헤더를 통해서 식별자를 전달하는 방식을 권장드립니다.

```http
X-DEVICE-ID: a3017217-3d46-4d7e-8d88-a0a905709fe4
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.hackle.io/development-guide/sdk/user-identifier/server-user-identifier.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
