# タグ設置

### タグを正しいタイミングで発火させる

#### 基本的な手順

上記で作成したフォーム画面用のタグをフォームに、サンクス画面用のタグをサンクスページに埋め込みます。

それぞれのタグを各ページの`<script>`タグ群の後方に設置して下さい。

フォームページ

```html
<!-- 他のscriptタグ群 -->
<script>
immedioConfig = {
    apiKey: 'xxxxxxxxxxxxxxxxxxxx',
    pageType: 'form',
}
</script>
<script src="https://sdk.immedio.io/sdk.js"></script>
```

サンクスページ

```html
<!-- 他のscriptタグ群 -->
<script>
immedioConfig = {
    pageType: 'thanks',
}
</script>
<script src="https://sdk.immedio.io/sdk.js"></script>
```

これで完了です。

#### GTMで発火させる場合

Google Tag Manager（GTM）を使ってタグを挿入することも可能です。

詳細は[Google Tag Managerを使ってタグを設置する](/guides/initial-setup/gtm.md)を参照してください。

#### SPA形式の場合

SPA形式の場合、index.htmlなど、各ページで共通して利用しているHTMLを編集します。作成したタグを`<script>`タグ群の後方に設置して下さい。\
GTMで設定することも可能です。その場合は、トリガーを「すべてのページビュー」に設定します。「すべてのページビュー」以外（例えば「履歴の変更」）に設定すると、immedioのタグが重複して発火することがあるので、使用しないでください。

### 確認

タグが正しく発火されているかどうかを確認してください。

確認方法は[こちら](/guides/tag-confirmation.md)を参照してください。

**immedioConfigが2回以上読み込まれていないことを確認してください。2回以上読み込まれている場合、immedioは正しく動作しません。**

* [ ] フォーム用のタグが正しく挿入されている
* [ ] サンクス用のタグが正しく挿入されている
* [ ] タグが2回以上読み込まれていない


---

# Agent Instructions: 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:

```
GET https://docs.immedio.io/guides/initial-setup/tag-placement.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
