> ## 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.

# Webmaster

> 了解如何在您的网站上满足我们的接入要求 Learn how to approve our demand on your site!

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 Updating ads.txt

为了在您的网站上投放RevIQ的广告资源，您需要将我们的卖家信息添加到您的ads.txt（授权数字卖家）文件中。
In order to run RevIQ's demand on your site, you will need to add our sellers to
your ads.txt (Authorized Digital Sellers).

**简而言之** — 将**your-domain.com/ads.txt**301重定向至**rev.iq/your-domain.com/ads.txt**，或手动添加我们托管文件中的内容。
TL;DR - Redirect (301) **your-domain.com/ads.txt** to **rev.iq/your-domain.com/ads.txt**, or
manually add the contents of our hosted file.

### 使用重定向 Using redirect

我们推荐重定向到我们的ads.txt文件。这样，每当RevIQ新增需求合作伙伴时，该文件便可自动更新。
We recommend using a redirect to our ads.txt file. This way, the file can be
automatically updated whenever RevIQ add new demand partners.

<Note>
  如果您有现有的ads.txt条目，我们可以将其添加到托管文件中。您的RevIQ技术联系人（hi
  ;D）可能已在您初次接入时将其导入，但如果您现有的ads.txt内容未出现在托管文件中，请联系我们。
  If you have existing ads.txt lines, we can add them to the hosted file. Your
  RevIQ tech contact (hi ;D) probably imported these during your onboarding, but
  if your existing ads.txt is not present in the hosted file, please reach out
  to us.
</Note>

<Warning>
  建议使用302（临时）重定向，这样您日后可以轻松更新或移除该重定向。
  Using a 302 (temporary) redirect is recommended, as it allows you to easily update or remove the redirect in the future.
</Warning>

<AccordionGroup>
  <Accordion icon="cloudflare" title="Cloudflare">
    1. 登录 [Cloudflare dashboard](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**：

    6. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and
       select your account and domain.

    7. Go to **Rules > Redirect Rules**.

    8. Under **Single Redirects**, select **Create Redirect Rule**.

    9. Enter a descriptive name for the rule in **Rule name**, <br />
       Example: `Redirect to RevIQ ads.txt`.

    10. Under **When incoming requests match**, define the **Custom filter expression**:

    <div style={{ marginInlineStart: "2rem" }}>
      <CloudflareFields
        fields={[
  { label: "Field", value: "URI Path" },
  { label: "Operator", value: "Equals" },
  { label: "Value", value: "/ads.txt", flex: 4, copy: true },
]}
      />
    </div>

    6. 在 **Then** 下，为匹配规则表达式的请求定义 URL 重定向设置：
    7. Under **Then**, define the URL redirect settings for requests matching the rule expression: <br />

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

    7. 如需保存并部署规则，选择 **Deploy**。如果暂未准备好部署，选择 **Save as
       Draft**。
    8. To save and deploy your rule, select **Deploy**. If you are not
       ready to deploy your rule, select **Save as Draft**.
  </Accordion>

  <Accordion icon="feather" title="Apache">
    将以下代码添加到您的`.htaccess`文件：
    Add the following line to your `.htaccess` file:

    <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`文件：
    Add the following line to your `nginx.conf` file:

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

### 手动设置 Manual setup

您也可以手动将我们托管文件中的条目添加到您自己的`ads.txt`文件中。
You can also manually add the lines from our hosted file to your own `ads.txt` file.

<Warning>
  如果您选择手动操作，请注意每当我们新增需求合作伙伴时，您需要手动更新您的`ads.txt`文件。
  If you choose to do this manually, keep in mind that you will need to manually update your `ads.txt` file whenever we add new demand partners.
</Warning>

<AccordionGroup>
  <Accordion icon="file" title="File">
    从托管文件 [https://rev.iq/your-domain.com/ads.txt](https://rev.iq/your-domain.com/ads.txt) 中复制条目，并将其添加到您自己的`ads.txt`文件中。

    Copy the lines from the hosted file at [https://rev.iq/your-domain.com/ads.txt](https://rev.iq/your-domain.com/ads.txt)
    and add them to your own `ads.txt` file.
  </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) 的条目粘贴进去。

    3. Go to **Advanced Ads > Settings** in your [WordPress dashboard](https://wordpress.com/home).

    4. Scroll down to **ads.txt**, paste the lines from the hosted file at
       [https://rev.iq/your-domain.com/ads.txt](https://rev.iq/your-domain.com/ads.txt).
  </Accordion>
</AccordionGroup>

## 验证 ads.txt Verifying ads.txt

如需验证您的 ads.txt 是否已正确配置，请访问 [https://your-domain.com/ads.txt](https://your-domain.com/ads.txt)。

To verify your ads.txt is correctly set up, visit
[https://your-domain.com/ads.txt](https://your-domain.com/ads.txt)
