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

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

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

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>
  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>
  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. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and
       select your account and domain.

    2. Go to **Rules > Redirect Rules**.

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

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

    5. 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. 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. 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">
    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">
    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

You can also manually add the lines from our hosted file to your own `ads.txt` file.

<Warning>
  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">
    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. Go to **Advanced Ads > Settings** in your [WordPress dashboard](https://wordpress.com/home).

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

## Verifying ads.txt

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