> 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/serve-sfw-ads.md).

# ExoClick で SFW 広告を配信する方法

各国で年齢確認法が施行され始めている中、パブリッシャーは、これらの法律に準拠しつつ、同時に収益への影響を最小限に抑える方法を見つける必要があります。そこで ExoClick は、広告ゾーンに追加できるいくつかのパラメータを導入しました。これにより、パブリッシャーは NSFW 製品をブロックできるだけでなく、実際にこれらのユーザーが年齢確認に成功したかどうかも追跡できます。このチュートリアルでは、これらのパラメータの使い方を紹介します。

## data-ex\_av

その `data-ex_av パラメータ` は、ユーザーが年齢確認を完了したかどうかを判定し、次の 3 つの値を指定できます。

* `"0"`: 年齢確認なし（未定義）
* `"1"`: 年齢確認済み
* `"2"`: 年齢確認なし（未確認、SFW）

コード例:

```html
<script async type="application/javascript" src="https://a.magsrv.com/ad-provider.js"></script> 
 <ins class="eas6a97888e2" data-zoneid="5209020"  data-ex_av="2"></ins> 
 <script>(AdProvider = window.AdProvider || []).push({"serve": {}});</script>
```

## data-block-ad-types

その `data-block-ad-types` パラメータを使うと、特定の広告タイプラベルをその場でブロックできます。NSFW 広告をブロックする目的では、このパラメータでは値 `"101"` のみを使用します。

コード例:

```html
<script async type="application/javascript" src="https://a.magsrv.com/ad-provider.js"></script> 
 <ins class="eas6a97888e2" data-zoneid="5209020"  data-block-ad-types="101"></ins> 
 <script>(AdProvider = window.AdProvider || []).push({"serve": {}});</script>
```

## パラメータの使用

ここまでの説明を踏まえると、SFW の広告を配信し、かつそのユーザーがまだ年齢確認を済ませていないことを示したい場合は、次のようにパラメータを組み込みます。

```html
<script async type="application/javascript" src="https://a.magsrv.com/ad-provider.js"></script> 
 <ins class="eas6a97888e2" data-zoneid="5209020" data-ex_av="2"  data-block-ad-types="101"></ins> 
 <script>(AdProvider = window.AdProvider || []).push({"serve": {}});</script>
```

{% hint style="info" %}
**注意**: 両方のパラメータを使用することが重要です。
{% endhint %}

そして、確認済みのユーザーに NSFW 広告を配信したい場合は、次のようにします。

```html
<script async type="application/javascript" src="https://a.magsrv.com/ad-provider.js"></script> 
 <ins class="eas6a97888e2" data-zoneid="5209020" data-ex_av="1"></ins> 
 <script>(AdProvider = window.AdProvider || []).push({"serve": {}});</script>
```

次のセクションでは、これらのパラメータを広告ゾーンに動的に追加する方法の例をいくつか紹介します。利用している年齢確認の方法によっては、ユーザーは Cookie、URL パラメータ、あるいはその他の方法で確認済みと判定される場合があります。最終的には、 **ユーザーの確認済みステータスを検出し、それに応じてパラメータを実装する責任はあなたにあります。**

### 例 1: Cookie 値に基づいてパラメータを変更する

年齢確認に成功したユーザーに対して、値が「yes」のファーストパーティ Cookie「verified\_user」を割り当てていると仮定します。このシナリオでは、ex\_av と data-block-ad-types パラメータを次のように動的に追加できます。

```html
//バナー広告ゾーン
<script async type="application/javascript" src="https://a.magsrv.com/ad-provider.js"></script>
<div id=”adspot1”>
<ins class="eas6a97888e2" data-zoneid="5409832" data-block-ad-types="101" data-ex_av="2"></ins>
<div id=”adspot2”>
<ins class="eas6a97888e2" data-zoneid="5632512" data-block-ad-types="101" data-ex_av="2"></ins>
<div id=”adspot3”>
<ins class="eas6a97888e2" data-zoneid="57382911" data-block-ad-types="101" data-ex_av="2"></ins>

//fpi広告ゾーン
<script async type="application/javascript" src="https://a.pemsrv.com/ad-provider.js"></script> 
<ins class="eas6a97888e35" data-zoneid="5045990" data-block-ad-types="101"  data-ex_av="2"></ins>

//Cookie に基づく動的関数
<script>
function getCookie(name) {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
}

const verifiedUser = getCookie("verified_user");
if (verifiedUser === "verifiedUser") {
const adInsElements = document.querySelectorAll("ins");
adInsElements.forEach(ins => {
ins.setAttribute("data-ex_av", "1");
ins.setAttribute("data-block-ad-types", "0");
});
}
(AdProvider = window.AdProvider || []).push({"serve": {}});
</script>
```

このスクリプトを使うと、「user\_verified」Cookie を持つユーザーに NSFW 広告を配信できます。ユーザーが年齢確認を完了した後は、スクリプトが Cookie を正しく検出できるようにページを更新する必要がある点に注意してください。

### 例 2: URL パラメータに基づいてパラメータを変更する

この例では、ユーザーが年齢確認に成功したときに、URL に「user\_verified=yes」というパラメータが付与されると仮定します。

```html
<script async type="application/javascript" src="https://a.magsrv.com/ad-provider.js"></script>
<div id="ad-container">
      <ins class="eas6a97888e20" data-zoneid="5662140" data-block-ad-types="101" data_ex_av="2"></ins>
</div>
    <script>
      (AdProvider = window.AdProvider || []).push({ serve: {} });
    </script>
    <script>
      const userVerified = new URLSearchParams(window.location.search).get(
        "user_verified"
      );
      if (userVerified === "yes") {
        let container = document.getElementById("ad-container");

        container.innerHTML = "";

        let newIns = document.createElement("ins");
        newIns.className = "eas6a97888e20";
        newIns.setAttribute("data-zoneid", "5662140");
        newIns.setAttribute("data-block-ad-types", "");
        newIns.setAttribute("data-ex_av","1");
        container.appendChild(newIns);

        (AdProvider = window.AdProvider || []).push({ serve: {} });
      }
    </script>
```

{% hint style="info" %}
**覚えておいてください**: これらのコード例はあくまで提案です。ユーザーがどのように年齢確認されるのかを Age Verification ツールと相談し、それに応じてスクリプトを調整してください。
{% endhint %}


---

# 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/serve-sfw-ads.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.
