> 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/advertisers/ja/konbjontorakkingu/torakkingumanyuaru/shopify-tracking.md).

# Shopifyでコンバージョンをトラッキングする方法

*このガイドは Shopify 専用です。コンバージョントラッキングの一般的な手順を知りたい場合は、以下をご確認ください。* [*広告主セクション*](/advertisers/ja/konbjontorakkingu/konbjontorakkingu.md)*.*

ExoClick を利用すると、グローバルトラフィックソース、ターゲティング機能、ビッグデータ、統計分析ツールにアクセスでき、結果の絞り込みやキャンペーンの最適化が可能です。このマニュアルでは、ExoClick ネットワーク上で Shopify ストアのコンバージョンを追跡する方法を説明します。

このドキュメントでは、イベントトラッキングの例を 2 つ紹介します：

* **checkout\_completed**
* **product\_added\_to\_cart**

例に進む前に、 [**コンバージョン目標**](/advertisers/ja/konbjontorakkingu/konbjontorakkingu.md#creating-a-conversion-goal) がアカウントで作成されていることを確認してください。

## チェックアウト完了イベント

ExoClick Pixel トラッキングを使用して Shopify ストアの購入を追跡したい場合は、 `checkout_completed` のようなイベントを利用できます。このイベントは、訪問者が購入を完了したときに記録され、各チェックアウトにつき 1 回トリガーされます。なお、この例ではコンバージョン目標の値は動的です。

を追加するには、 `checkout_completed` イベントを Shopify ストアに追加するには、次の手順に従ってください：

{% stepper %}
{% step %}
へ移動し **BeMobアカウントの** Shopify の管理画面で。
{% endstep %}

{% step %}
選択し **顧客イベント**.
{% endstep %}

{% step %}
次をクリック **カスタムピクセルを追加**.

<figure><img src="/files/daf6a742d04f2829f88fe80bc680e92c364202b2" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
設定 **マーケティングへの許可** クッキーポリシーに準拠するために必要です。

<figure><img src="/files/90071fbde0c93ed80ea6248a97e835c0b47d53c1" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
次のコードを追加してください：

```javascript
analytics.subscribe('checkout_completed', (event) => {
  const el = document.createElement('script');
  el.setAttribute('src', 'https://a.magsrv.com/tag_gen.js');
  el.setAttribute('data-goal', 'XXXXX');
  const cost = event.data.checkout.subtotalPrice?.amount || event.data.checkout.totalPrice?.amount;
  el.setAttribute('data-value', cost);

  document.body.appendChild(el);
});
```

{% endstep %}

{% step %}
必ず `'XXXXX'` を独自の目標 ID に置き換えてください。
{% endstep %}

{% step %}
最後に、 **接続** ボタン。

<figure><img src="/files/68f0acf475e7bd2f26382e0b36179eb944c1e1cb" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

接続したら、Shopify のテスト支払い機能を使用してテスト購入を行い、すべてが正しく設定されていることを確認してください。

チェックアウトが成功すると、ExoClick 管理ダッシュボードの収益セクションに、動的な値とともにコンバージョンが記録されているはずです。

{% hint style="info" %}
**注:** コンバージョンが ExoClick 管理パネルに表示されるまで、数分かかる場合があります。
{% endhint %}

<figure><img src="/files/a54b4a3a898e3cf7b2b6321a9d010276adaaaa53" alt=""><figcaption></figcaption></figure>

## 商品をカートに追加したイベント

この `product_added_to_cart` イベントは、顧客が商品をショッピングカートに追加したときにトラッキングします。なお、この例ではコンバージョン目標に割り当てられた値はありません。

設定するには、先ほど説明した `checkout_completed` イベントと同じ手順に従ってください。ただし、今回はコードが異なります。

* 次のコードを追加してください：

```javascript
analytics.subscribe('product_added_to_cart', (event) => {
  const el = document.createElement('script');
  el.setAttribute('src', 'https://a.magsrv.com/tag_gen.js');
  el.setAttribute('data-goal', 'XXXXXX');

  document.body.appendChild(el);
});
```

* 必ず `'XXXXX'` を独自の目標 ID に置き換えてください。
* 最後に、 **接続** ボタン。

接続したら、商品をカートに追加して設定をテストしてください。正しく設定されていれば、コンバージョンが ExoClick 管理パネルに反映されます。

{% hint style="info" %}
**注:** コンバージョンが ExoClick 管理パネルに表示されるまで、数分かかる場合があります。
{% endhint %}

<figure><img src="/files/6f471e5b6a023cf0e7742328c80495f87058c7e2" alt=""><figcaption></figcaption></figure>

## その他のイベント設定

他の種類のイベントを設定したい場合は、Shopify マニュアルの [Shopify 標準イベントのドキュメント](https://shopify.dev/docs/api/web-pixels-api/standard-events).

{% hint style="warning" %}
**注:** を参照してください。これらのイベントはカスタムで作成されています。さらにイベントを追加したい場合は、ご自身で開発作業が必要になることにご留意ください。
{% endhint %}

Shopify ピクセルに関する追加情報を探したい場合は、こちらのページを参照してください： [Shopify ピクセルのドキュメント](https://help.shopify.com/en/manual/promoting-marketing/pixels)


---

# 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/advertisers/ja/konbjontorakkingu/torakkingumanyuaru/shopify-tracking.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.
