> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rev.iq/llms.txt
> Use this file to discover all available pages before exploring further.

# 웹마스터

> 사이트에서 디맨드를 승인하는 방법을 알아보세요!

export const domain = (() => {
  const placeholder = "your-domain.com";
  if (typeof window !== "undefined" && !globalThis.__revDomainSetup) {
    globalThis.__revDomainSetup = true;
    function textNodes(node) {
      if (node.nodeType === Node.TEXT_NODE) return [node];
      const nodes = [];
      for (const child of node.childNodes) {
        nodes.push(...textNodes(child));
      }
      return nodes;
    }
    function anchorNodes(node) {
      if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "A") return [node];
      const nodes = [];
      for (const child of node.childNodes) {
        nodes.push(...anchorNodes(child));
      }
      return nodes;
    }
    const domain = globalThis.__revDomain || new URLSearchParams(globalThis.location.search).get('domain') || "yourdomain.com";
    globalThis.__revDomain = domain;
    if (globalThis.__revDomainObs) return;
    const obs = globalThis.__revDomainObs || new MutationObserver(mutations => {
      for (const {addedNodes, removedNodes, target} of mutations) {
        for (const node of [...addedNodes, target]) {
          if (node instanceof HTMLScriptElement) continue;
          if (node instanceof HTMLStyleElement) continue;
          for (const textNode of textNodes(node)) {
            if (textNode.nodeValue && textNode.nodeValue.includes(placeholder)) {
              setTimeout(() => {
                textNode.nodeValue = textNode.nodeValue.replace(placeholder, domain);
              }, 100);
            }
          }
          for (const anchorNode of anchorNodes(node)) {
            if (anchorNode.href && anchorNode.href.includes(placeholder)) {
              setTimeout(() => {
                anchorNode.href = anchorNode.href.replace(placeholder, domain);
              }, 100);
            }
          }
        }
      }
    });
    obs.observe(document.body, {
      childList: true,
      subtree: true
    });
  }
  return placeholder;
})();

export const CloudflareFields = ({fields}) => {
  const CopyButton = ({value}) => {
    return <button onClick={e => {
      navigator.clipboard.writeText(value);
      e.target.innerText = "✅";
      setTimeout(() => e.target.innerText = "📋", 2000);
    }}>
        {"📋"}
      </button>;
  };
  const CloudflareField = ({label, value, copy, ...rest}) => <div {...rest}>
      <sub style={{
    bottom: 0
  }}>{label}</sub>
      <br />
      <div style={{
    padding: "10px",
    border: "1px solid #88888888",
    borderRadius: "5px",
    marginBottom: "10px",
    display: "flex",
    justifyContent: "space-between"
  }}>
        <strong>{value}</strong> {copy && <CopyButton value={value} />}
      </div>
    </div>;
  return <div style={{
    display: "flex",
    gap: "0.5rem"
  }}>
      {fields.map(({flex, ...rest}) => <CloudflareField {...rest} style={{
    flex: flex ?? "1"
  }} />)}
    </div>;
};

export const Text = ({text}) => text;

## ads.txt 업데이트

RevIQ의 디맨드를 사이트에서 실행하려면 ads.txt(공인 디지털 판매자)에 셀러를 추가해야 합니다.

요약 - **your-domain.com/ads.txt**를 **rev.iq/your-domain.com/ads.txt**로 리다이렉트(302)하거나,
호스팅된 파일의 내용을 수동으로 추가하세요.

### 리다이렉트 사용

ads.txt 파일로의 리다이렉트를 사용하는 것을 권장합니다. 이렇게 하면 RevIQ가 새로운 디맨드 파트너를
추가할 때마다 파일이 자동으로 업데이트됩니다.

<Note>
  기존 ads.txt 항목이 있는 경우, 호스팅된 파일에 추가해 드릴 수 있습니다. RevIQ 기술 담당자(안녕하세요 ;D)가
  온보딩 시 이미 가져왔을 수 있지만, 기존 ads.txt가 호스팅된 파일에 포함되어 있지 않다면
  문의해 주세요.
</Note>

<Warning>
  302(임시) 리다이렉트 사용을 권장합니다. 향후 리다이렉트를 쉽게 업데이트하거나 제거할 수 있기 때문입니다.
</Warning>

<AccordionGroup>
  <Accordion icon="cloudflare" title="Cloudflare">
    1. [Cloudflare 대시보드](https://dash.cloudflare.com)에 로그인하고
       계정과 도메인을 선택합니다.

    2. **Rules > Redirect Rules**로 이동합니다.

    3. **Single Redirects** 아래에서 **Create Redirect Rule**을 선택합니다.

    4. **Rule name**에 규칙의 설명적인 이름을 입력합니다.<br />
       예: `Redirect to RevIQ ads.txt`

    5. **When incoming requests match** 아래에서 **Custom filter expression**을 정의합니다:

    <div style={{marginInlineStart: "2rem", }}>
      <CloudflareFields
        fields={[
     { label: "필드", value: "URI Path" },
     { label: "연산자", value: "Equals" },
     { label: "값", value: "/ads.txt", flex: 4, copy: true },
  ]}
      />
    </div>

    6. **Then** 아래에서 규칙 표현식과 일치하는 요청의 URL 리다이렉트 설정을 정의합니다: <br />

    <div style={{marginInlineStart: "2rem", }}>
      <CloudflareFields
        fields={[
     { label: "유형", value: "Static" },
     { label: "URL", value: "https://rev.iq/" + "your-domain.com" + "/ads.txt", flex: 4, copy: true },
     { label: "상태 코드", value: "302" },
  ]}
      />
    </div>

    7. 규칙을 저장하고 배포하려면 **Deploy**를 선택합니다. 규칙을 배포할 준비가
       되지 않았다면 **Save as Draft**를 선택합니다.
  </Accordion>

  <Accordion icon="feather" title="Apache">
    `.htaccess` 파일에 다음 줄을 추가합니다:

    <pre><code>Redirect 302 /ads.txt <Text text={`https://rev.iq/your-domain.com/ads.txt`} /></code></pre>
  </Accordion>

  <Accordion icon="hexagon" title="Nginx">
    `nginx.conf` 파일에 다음 줄을 추가합니다:

    ```nginx nginx.conf theme={null}
    location = /ads.txt {
        return 302 https://rev.iq/your-domain.com/ads.txt;
    }
    ```
  </Accordion>
</AccordionGroup>

### 수동 설정

호스팅된 파일의 내용을 직접 `ads.txt` 파일에 수동으로 추가할 수도 있습니다.

<Warning>
  수동으로 설정하는 경우, 새로운 디맨드 파트너가 추가될 때마다 `ads.txt` 파일을 수동으로 업데이트해야 합니다.
</Warning>

<AccordionGroup>
  <Accordion icon="file" title="파일">
    [https://rev.iq/your-domain.com/ads.txt](https://rev.iq/your-domain.com/ads.txt)의
    호스팅된 파일에서 내용을 복사하여 `ads.txt` 파일에 추가합니다.
  </Accordion>

  <Accordion icon="wordpress" title="Wordpress - Advanced Ads">
    1. [WordPress 대시보드](https://wordpress.com/home)에서 **Advanced Ads > Settings**로 이동합니다.

    2. **ads.txt**까지 스크롤하고,
       [https://rev.iq/your-domain.com/ads.txt](https://rev.iq/your-domain.com/ads.txt)의
       호스팅된 파일에서 내용을 붙여넣습니다.
  </Accordion>
</AccordionGroup>

## ads.txt 확인

ads.txt가 올바르게 설정되었는지 확인하려면
[https://your-domain.com/ads.txt](https://your-domain.com/ads.txt)를 방문하세요.
