# server API로 주문의 외부 유입경로 집계 방법

## 주문의 유입경로를 집계하고 싶은데, 어떻게 처리할 수 있을까요?

매출이 발생하는 외부채널 별 유입경로는 server API의 channelType 또는 trackingKey 필드값을 활용하여 집계할 수 있습니다.

***

## 1. channelType (외부주문 채널)

<mark style="color:blue;">**활용방법**</mark>

어드민에서 상품등록 시 '가격비교사이트 등록(아래 이미지)' 설정을 해줄 경우, 외부채널과 연동이 됩니다.

<figure><img src="/files/cEDXqpWRcZhubTUF6y5K" alt=""><figcaption></figcaption></figure>

* channelType=`NAVER_EP`, `FACEBOOK`,`WONDER` 3가지에 한하여\
  상품등록 시 EP등록 처리(페이스북의 경우 페이스북의 API 연동)를 하실 경우, 해당 외부 채널을 통해 고객이 상품상세페이지 진입 시, url에 channelType 파라미터가 자동으로 추가됩니다.
* channelType은 위에 정의된 값 외에도 필요한 값을 사용할 수 있으며, 주문결제 시에 파라미터로 전달된 channelType 값을 입력해주시면 됩니다.\
  주문서 생성시점에 <https://docs.shopby.co.kr/?url.primaryName=order/#/OrderSheet/post-order-sheet> API에 넣어주면, 주문 생성 시 저장됩니다.
* 이렇게 주문 시 입력된 channelType은, 쇼핑몰 정산 데이터 조회하기 server API를 호출하여 조회할 수 있습니다.\
  <https://server-docs.shopby.co.kr/?url.primaryName=order-friends/#/Settlements/get-orders-sales>

***

<mark style="color:blue;">**참고사항**</mark>

* channelType은 서비스어드민 내에서 조회가능한 항목이 아닙니다.
* channelType은 \[서비스어드민>프로모션 관리> 할인쿠폰관리]에서 할인쿠폰 등록 시, 할인쿠폰 채널설정을 하면 외부 채널을 통해 상품상세페이지에 유입된 경우, 채널별로 할인 쿠폰의 다운로드 및 사용을 제한 할 수 있습니다.

<figure><img src="/files/gmj3h1K2raEpbm7p7stT" alt=""><figcaption></figcaption></figure>

***

## 2. trackingKey (주문 추적키)

<mark style="color:blue;">**의미**</mark>

trackingKey는 쇼핑몰에서 생성되어 주문번호를 특정하는, 주문을 추적하는데 사용되는 구분 값입니다. 샵바이 쇼핑몰솔루션 외부에서 생성한 key값을, 샵바이에서 주문생성 시점에 저장하여 이후 해당 키값으로 주문을 추적하는 용도입니다.

<mark style="color:blue;">**활용방법**</mark>

* 주문서 생성 API <https://docs.shopby.co.kr/?url.primaryName=order/#/OrderSheet/post-order-sheet에> 넣어주면, 주문 생성 시 저장됩니다.
* trakcingKey는 아래 주문 조회하기 server API로 조회하여 추적이 가능합니다.\
  <https://server-docs.shopby.co.kr/?url.primaryName=order/#/Orders/get-orders>

{% hint style="info" %}
trackingKey는 서비스어드민 내에서 조회가능한 항목이 아닙니다.
{% endhint %}


---

# Agent Instructions: 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:

```
GET https://workspace-help.nhn-commerce.com/contents/faq/server-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
