e コマースを測定する

e コマース イベントをセットアップすると、ユーザーのショッピング行動についての情報を収集できます。特に人気のある商品を定量的に示したり、プロモーションや商品配置が収益に及ぼす影響を確認したりすることが可能です。

この記事では、各 e コマース イベントの内容と導入すべき場面を説明します。e コマース イベントのセットアップ手順を具体例で確認するには、購入イベントをセットアップするをご覧ください。

始める前に

あらかじめ、ウェブサイトに Google タグを追加していることと、アナリティクスとウェブサイトのソースコードにアクセスできることを確認してください。

最適化案

  • デバッグモードを有効化しましょう。イベントをリアルタイムで確認できるようになり、トラブルシューティングも容易になります。
  • e コマース イベントとともにカスタム パラメータを送信する場合は、カスタム ディメンションとカスタム指標の制限事項を確認しておきましょう。
  • value(収益)データを送信する際は、収益関連指標が正しく計算されるよう、currency を設定しましょう。
  • データを入手できている e コマース パラメータは、任意使用のものも含め、すべて設定しましょう。
  • サンプルの e コマースサイトで、ウェブサイトをタグ設定する方法を具体的に確認しておきましょう。

実装

一般的な e コマースの実装では、次のようなアクションを測定します。

これらのアクションの中心にあるのは、販売している商品やサービスの情報です。商品やサービスの情報は、アイテムの配列として e コマース イベントに追加することができます。商品アイテム配列には、既定のパラメータに加えて、カスタム パラメータを最大 27 個まで追加可能です。

下のコードは、商品アイテムの情報を集めた items 配列の作成方法を示したものです。本ガイドでは、この商品アイテム配列を例に各イベントを解説していきます。items 配列には最大 200 個まで要素を追加できます。

items: [
    {
      item_id: "SKU_12345",
      item_name: "Stan and Friends Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 2.22,
      index: 0,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "green",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 9.99,
      quantity: 1
    },
    {
      item_id: "SKU_12346",
      item_name: "Google Grey Women's Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 3.33,
      index: 1,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "gray",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 20.99,
      quantity: 1
    }
]

UA の e コマース実装から移行する

すでにユニバーサル アナリティクスで e コマースを実装済みの場合は、以下のいずれかの方法で Google アナリティクス 4 に移行できます。

  • UA の e コマース実装を使って GA4 の e コマース イベントにデータを供給する
  • UA の e コマース実装を GA4 の e コマース イベントに置き換える
  • UA と GA4 の両方でアナリティクスに e コマースデータを送信する

運用中の e コマース実装をユニバーサル アナリティクスから Google アナリティクス 4 へ移行する方法について詳しくは、GA4 e コマース移行ガイド(Google タグ向け)をご覧ください。

リストからアイテムを選択する

ユーザーに結果のリストが表示された時点で、view_item_list イベントを送信します。このイベントには、配列パラメータ items として、表示された商品アイテムの情報を含めます。送信する各パラメータについて詳しくは、イベントのリファレンスをご覧ください。

gtag("event", "view_item_list", {
  item_list_id: "related_products",
  item_list_name: "Related products",
  items: [
    {
      item_id: "SKU_12345",
      item_name: "Stan and Friends Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 2.22,
      index: 0,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "green",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 9.99,
      quantity: 1
    }
  ]
});

ユーザーがリストからアイテムを選択したら、select_item イベントを送信します。このイベントには、配列パラメータ items として、選択された商品アイテムの情報を含めます。送信する各パラメータについて詳しくは、イベントのリファレンスをご覧ください。

gtag("event", "select_item", {
  item_list_id: "related_products",
  item_list_name: "Related products",
  items: [
    {
      item_id: "SKU_12345",
      item_name: "Stan and Friends Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 2.22,
      index: 0,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "green",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 9.99,
      quantity: 1
    }
  ]
});

アイテム詳細の閲覧

商品アイテムの詳細が閲覧された回数を測定するには、ユーザーがアイテムの詳細画面を閲覧するたびに view_item イベントを送信します。送信する各パラメータについて詳しくは、イベントのリファレンスをご覧ください。

gtag("event", "view_item", {
  currency: "USD",
  value: 7.77,
  items: [
    {
      item_id: "SKU_12345",
      item_name: "Stan and Friends Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 2.22,
      index: 0,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "green",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 9.99,
      quantity: 1
    }
  ]
});

ショッピング カートへの商品の追加または削除

ショッピング カートへの商品アイテム追加を測定するには、add_to_cart イベントを送信します。該当アイテムを items 配列として持たせましょう。送信する各パラメータについて詳しくは、イベントのリファレンスをご覧ください。

gtag("event", "add_to_cart", {
  currency: "USD",
  value: 7.77,
  items: [
    {
      item_id: "SKU_12345",
      item_name: "Stan and Friends Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 2.22,
      index: 0,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "green",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 9.99,
      quantity: 1
    }
  ]
});

「あとで買うリスト」への商品アイテム追加を測定することも可能です。該当アイテムを items 配列として持たせた add_to_wishlist イベントを送信しましょう。送信する各パラメータについて詳しくは、イベントのリファレンスをご覧ください。

gtag("event", "add_to_wishlist", {
  currency: "USD",
  value: 7.77,
  items: [
    {
      item_id: "SKU_12345",
      item_name: "Stan and Friends Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 2.22,
      index: 0,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "green",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 9.99,
      quantity: 1
    }
  ],
});

その後ユーザーがカートを閲覧したときは、view_cart イベントにカート内の全アイテムの情報を持たせて送信します。送信する各パラメータについて詳しくは、イベントのリファレンスをご覧ください。

gtag("event", "view_cart", {
  currency: "USD",
  value: 7.77,
  items: [
    {
      item_id: "SKU_12345",
      item_name: "Stan and Friends Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 2.22,
      index: 0,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "green",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 9.99,
      quantity: 1
    }
  ]
});

カートからの商品アイテム削除を測定するには、remove_from_cart イベントを送信します。送信する各パラメータについて詳しくは、イベントのリファレンスをご覧ください。

gtag("event", "remove_from_cart", {
  currency: "USD",
  value: 7.77,
  items: [
    {
      item_id: "SKU_12345",
      item_name: "Stan and Friends Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 2.22,
      index: 0,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "green",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 9.99,
      quantity: 1
    }
  ]
});

購入手続きの開始

購入手続きの開始を測定するには、対応するフィールドで定義した商品アイテム(複数可)を持たせた begin_checkout イベントを送信します。この段階でクーポンを追加することも可能です。注文全体が対象であればイベントに、特定の商品アイテムが対象であれば items 配列の該当要素に追加しましょう。送信する各パラメータについて詳しくは、イベントのリファレンスをご覧ください。

gtag("event", "begin_checkout", {
  currency: "USD",
  value: 7.77,
  coupon: "SUMMER_FUN",
  items: [
    {
      item_id: "SKU_12345",
      item_name: "Stan and Friends Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 2.22,
      index: 0,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "green",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 9.99,
      quantity: 1
    }
  ]
});

ユーザーが購入手続きの次のステップへ進み、配送先情報を登録したら、add_shipping_info イベントを送信します。ユーザーが選択した配送方法、たとえば陸送(Ground)、航空輸送(Air)、翌日配送(Next-day)などを、shipping_tier パラメータで指定します。送信する各パラメータについて詳しくは、イベントのリファレンスをご覧ください。

gtag("event", "add_shipping_info", {
  currency: "USD",
  value: 7.77,
  coupon: "SUMMER_FUN",
  shipping_tier: "Ground",
  items: [
    {
      item_id: "SKU_12345",
      item_name: "Stan and Friends Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 2.22,
      index: 0,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "green",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 9.99,
      quantity: 1
    }
  ]
});

ユーザーが支払い情報を登録したら、add_payment_info イベントを送信します。必要であれば、選択された支払い方法を payment_type としてイベントに組み込みます。送信する各パラメータについて詳しくは、イベントのリファレンスをご覧ください。

gtag("event", "add_payment_info", {
  currency: "USD",
  value: 7.77,
  coupon: "SUMMER_FUN",
  payment_type: "Credit Card",
  items: [
    {
      item_id: "SKU_12345",
      item_name: "Stan and Friends Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 2.22,
      index: 0,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "green",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 9.99,
      quantity: 1
    }
  ]
});

購入または払い戻し

購入の発生を測定するには、対応するフィールドで定義した商品アイテム(複数可)を持たせた purchase イベントを送信します。送信する各パラメータについて詳しくは、イベントのリファレンスをご覧ください。

gtag("event", "purchase", {
    transaction_id: "T_12345",
    value: 25.42,
    tax: 4.90,
    shipping: 5.99,
    currency: "USD",
    coupon: "SUMMER_SALE",
    items: [
     {
      item_id: "SKU_12345",
      item_name: "Stan and Friends Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 2.22,
      index: 0,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "green",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 9.99,
      quantity: 1
    },
    {
      item_id: "SKU_12346",
      item_name: "Google Grey Women's Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 3.33,
      index: 1,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "gray",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 20.99,
      promotion_id: "P_12345",
      promotion_name: "Summer Sale",
      quantity: 1
    }]
});

払い戻しを測定するには、該当する transaction_id と、item_id および quantity で定義した商品アイテム(複数可)を持たせた refund イベントを送信します。アナリティクスで払い戻しの指標を商品アイテムごとに確認できるよう、refund イベントに商品アイテム情報を含めることをおすすめします。

送信する各パラメータについて詳しくは、イベントのリファレンスをご覧ください。

gtag("event", "refund", {
  currency: "USD",
  transaction_id: "T_12345", // Transaction ID. Required for purchases and refunds.
  value: 12.21,
  coupon: "SUMMER_FUN",
  shipping: 3.33,
  tax: 1.11,
  items: [
    {
      item_id: "SKU_12345",
      item_name: "Stan and Friends Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 2.22,
      index: 0,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "green",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 9.99,
      quantity: 1
    }
  ]
});

プロモーションの適用

e コマースでは、内部プロモーション(セールを宣伝するバナー広告など)のインプレッションとクリックの測定をサポートしています。

プロモーションのインプレッションを測定するには、最初のスクリーン ビューの発生時に、プロモーションの対象商品を items パラメータとして指定した view_promotion イベントを送信するのが一般的です。送信する各パラメータについて詳しくは、イベントのリファレンスをご覧ください。

gtag("event", "view_promotion", {
  creative_name: "Summer Banner",
  creative_slot: "featured_app_1",
  promotion_id: "P_12345",
  promotion_name: "Summer Sale",
  items: [
    {
      item_id: "SKU_12345",
      item_name: "Stan and Friends Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 2.22,
      index: 0,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "green",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 9.99,
      quantity: 1
    }
  ]
});

ユーザーがプロモーションをクリックしたことを記録するには、select_promotion イベントに該当アイテムを item パラメータとして持たせて送信します。送信する各パラメータについて詳しくは、イベントのリファレンスをご覧ください。

gtag("event", "select_promotion", {
  creative_name: "Summer Banner",
  creative_slot: "featured_app_1",
  promotion_id: "P_12345",
  promotion_name: "Summer Sale",
  items: [
    {
      item_id: "SKU_12345",
      item_name: "Stan and Friends Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 2.22,
      index: 0,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "green",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 9.99,
      quantity: 1
    }
  ],
});