> For the complete documentation index, see [llms.txt](https://docs.exoclick.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.exoclick.com/tutorials/ja/chtoriaru/paburisshkechtoriaru/poppuandridairekutono.md).

# ポップアンダーリダイレクトの例

次のページでは、使用できるさまざまなユースケースを一覧で紹介しています **Redirect Popunder URL** という形式のポップアンダーを使用して、特定の条件で広告を発火させることができます。

## Adblock 下でポップアンダーを配信する

もしあなたが **Inline + Remote Script** 版のポップアンダーを使いたくない場合は、次の手順に従ってください:

{% stepper %}
{% step %}
作成してください `.js` という名前の `ads.js` ファイルを、以下のコードを含めて

```js
isAdblockActive = false;
```

{% endstep %}

{% step %}
次に、別のファイルを作成して、名前を `domains.js` ファイルを、以下のコードを含めて

```js
let storedDomain = null;
fetch("https://ads.exoclick.com/adblock-domains.php")
  .then(r => {
    if (!r.ok) {
      throw new Error("ネットワーク応答が正常ではありませんでした (" + r.status + ")");
    }
    return r.json();
  })
  .then(data => {
    if (data.success && data.domain) {
      storedDomain = data.domain;
    } else {
      logError("API がエラーを返しました: " + (data.message || "不明なエラー"));
    }
  })
  .catch(err => {
    logError("取得に失敗しました: " + err.message);
  });
```

{% endstep %}

{% step %}
両方のファイルをウェブサイトのサーバーに配置してください。次に、サイトの HTML に以下を追加します:

```html
<script type="text/javascript">var isAdBlockActive=true;</script>
<script type="text/javascript" src="domains.js"></script>
<script type="text/javascript" src="ads.js" ></script>
<a id="rd" href="#" target="_blank">Redirect Domain</a>
<script>
var link = document.getElementById('rd');
link.addEventListener("click", function (){
	if (isAdBlockActive) {
	window.location.replace("https://" + storedDomain + "/v1/link.php?cat=&idzone=XXXXX&type=8&block=1");
      } else {
    window.location.replace("https://s.pemsrv.com/v1/link.php?cat=&idzone=XXXXX&type=8");
      }
});
</script>
```

Redirect Popunder は、ユーザーが id `rd`のリンクをクリックしたときに発火します。次に、ブラウザで Adblock が有効になっている場合、 `isAdBlockActive` は true に設定されます。なぜなら `ads.js` はブロックされ、リダイレクトポップアンダーは `domains.js`から取得した動的な adblock ドメインを使用できるためです。 `&block=1` パラメータにより、ポップアンダーはトラフィックを Adblock として登録できます。
{% endstep %}
{% endstepper %}

## SFW 広告を配信する

その `ex_av` と `block_ad_types` これらのパラメータは Redirect Domain Popunder に追加でき、ユーザーが年齢確認を通過したかどうかを記録し、NSFW 広告をブロックできます。

以下のコードは [**ExoClick で SFW 広告を配信する方法**](/tutorials/ja/chtoriaru/paburisshkechtoriaru/serve-sfw-ads.md) に基づいており、ユーザーが `userVerified` クッキーを持っているかどうかに応じて Redirect Domain Popunder を読み込みます。このクッキーは、ユーザーが年齢確認を通過した後に設定されます。

```html
<a id="rd" href="#" target="_blank">Redirect Domain</a>
<script>
function getCookie(name) {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
}
const link = document.getElementById('rd');
const verifiedUser = getCookie("verified_user");
link.addEventListener("click", function (){
  if (verifiedUser === "yes") {
    window.location.replace("https://s.pemsrv.com/v1/link.php?cat=&idzone=XXXXX&type=8&ex_av=1");
    }
  else {
    window.location.replace("https://s.pemsrv.com/v1/link.php?cat=&idzone=XXXXX&type=8&ex_av=2&blocked_ad_types=101");)
  }
});
</script>
```

## サイトの URL に特定のパラメータがある場合に、特定のラベルを持つキャンペーンをブロックする

以下のコードは [**data-block-ad-types を使って広告タイプを動的にブロックする方法**](/tutorials/ja/chtoriaru/paburisshkechtoriaru/dynamically-block-ads-using-data-block-ad-types.md) また、ポップアンダーが読み込まれる URL の特定のパラメータから値を読み取ります。これは、特定のパラメータを使ってトラフィック元を識別しているパブリッシャーにとって便利です。

この例では、 `utm_source` というパラメータを探しており、ブロックするラベルは **検証済みの偽陽性**:

```html
<a id="rd" href="#" target="_blank">Redirect Domain</a>
<script>
const link = document.getElementById('rd');
const pb = new URLSearchParams(window.location.search).get("utm_source");
link.addEventListener("click", function (){
  if (pb === YYYYYYYYYYY) { // YYYYY は、このブロックを適用したいトラフィック元を識別するためにパブリッシャーが使用する任意の値に対応します
    window.location.replace("https://s.pemsrv.com/v1/link.php?cat=&idzone=XXXXX&type=8&blocked_ad_types=98");
    }
  else {
    window.location.replace("https://s.pemsrv.com/v1/link.php?cat=&idzone=XXXXX&type=8");)
  }
});
</script>
```


---

# 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.exoclick.com/tutorials/ja/chtoriaru/paburisshkechtoriaru/poppuandridairekutono.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.
