> 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 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.immedio.io/guides/initial-setup/tag-placement.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.
