> For the complete documentation index, see [llms.txt](https://docs.immedio.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.immedio.io/guides/initial-setup/tag-placement.md).

# タグ設置

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

#### 基本的な手順

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

それぞれのタグを各ページの`<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
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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
