---
metadata:
  - name: generator
    content: Diplodoc Platform v5.55.2
alternate:
  - https://yandex.com/support/metrica/en/data/e-commerce.md
  - https://yandex.com/support/metrica/es/data/e-commerce.md
  - https://yandex.com/support/metrica/pt/data/e-commerce.md
  - https://yandex.com/support/metrica/ru/data/e-commerce.md
  - https://yandex.com/support/metrica/tr/data/e-commerce.md
  - https://yandex.com/support/metrica/zh/data/e-commerce.md
  - href: zh/data/e-commerce.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
title: 如何手动启用 E-commerce
description: 如何手动启用 E-commerce。
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/support/metrica/zh/llms.txt


# 如何手动启用 E-commerce

<!-- source: zh/_includes/code/counter-initialize/id-counter-initialize/rest-js.md -->
{% note warning %}

使用 JavaScript API 需要了解 HTML 和 JavaScript。 如果您不了解这些语言，请联系您的网站开发人员或站长。

{% endnote %}
<!-- endsource: zh/_includes/code/counter-initialize/id-counter-initialize/rest-js.md -->


1. <!-- source: zh/_includes/ecommerce/enabling/id-enabling/1.md -->
   [前往 Yandex Metrica](https://metrica.yandex.com)。
   <!-- endsource: zh/_includes/ecommerce/enabling/id-enabling/1.md -->
    
1. <!-- source: zh/_includes/ecommerce/enabling/id-enabling/2.md -->
   Select the tag that you want to enable E-commerce for.
   <!-- endsource: zh/_includes/ecommerce/enabling/id-enabling/2.md -->
    
1. 在计数器设置中，启用 **E-commerce** 选项。 用于从 `dataLayer` 收集数据的容器将默认添加到代码片段中。
    ![](../_assets/ecom-set.png){.border-yes}
    
    您还可以使用 [ecommerce: true](https://yandex.com/support/metrica/zh/code/counter-initialize.md#param-ecommerce) 参数初始化计数器。
    
1. 在包含有关商品和订单的信息（商品详情、Add to basket 按钮等）的所有网站页面中安装（或更新）代码片段。
    为此，请复制计数器代码。 确保网站上的代码片段包含以下行：`ecommerce:"dataLayer"`。
    
    ![](../_assets/ecom-code.png){.border-yes}
    
    如果您的网站已设置 Google Analytics Enhanced Ecommerce 或 Ecommerce (GA4)（包括使用 Global Site Tag），则由于 Yandex Metrica 使用兼容的数据格式，因此无需额外设置，即可自动收集您网站的数据。 在这种情况下，请跳过第 5 步。
1. 在您的网站上，通过 JavaScript API [配置数据传输](https://yandex.com/support/metrica/zh/ecommerce/data.md)（关于将商品加入购物篮、购物等）。 为了传输信息，您需要在网站上创建一个脚本，该脚本将负责[指定格式](https://yandex.com/support/metrica/zh/ecommerce/data.md)的某个事件（例如，下订单）。 您可以配置传输所有事件以接收更全面的数据，或仅传输部分事件。
    如果您没有设置 Google Analytics Enhanced Ecommerce，请按照此步骤操作。 对于每个活动，创建一个电子商务对象并将其放置在数据容器中（默认情况下 — `dataLayer`）。
    
1. [检查 ](https://yandex.com/support/metrica/zh/ecommerce/check.md)E-commerce 设置是否正确。
1. <!-- source: zh/_includes/ecommerce/enabling/id-enabling/5.md -->
   第一次数据传输后几个小时，数据就会出现在 Yandex Metrica 中。 要查看报表，请转至 Yandex Metrica 并打开 **Reports** → **E-commerce**。

   [E-commerce 报表](https://yandex.com/support/metrica/zh/data/e-commerce-reports.md)
   <!-- endsource: zh/_includes/ecommerce/enabling/id-enabling/5.md -->
    

## 了解详情

- [故障排除](https://yandex.com/support/metrica/zh/ecommerce/troubleshooting.md)

<!-- source: zh/_includes/buttons/chat-button.md -->
[与我们聊天](https://yandex.com/chat/#/user/036e6a02-3620-9cdc-4c5e-a34667a7379e?utm_source=spravka){.button}

<!-- source: zh/_includes/styles/href-to-button.md -->

<!-- endsource: zh/_includes/styles/href-to-button.md -->
<!-- endsource: zh/_includes/buttons/chat-button.md -->

<!-- source: zh/_includes/reports/support-button.md -->
[联系我们](https://yandex-ad.cn/contact){.button}


<!-- source: zh/_includes/styles/cut-button.md -->

<!-- endsource: zh/_includes/styles/cut-button.md -->

<!-- source: zh/_includes/styles/href-to-button.md -->

<!-- endsource: zh/_includes/styles/href-to-button.md -->
<!-- endsource: zh/_includes/reports/support-button.md -->

<!-- source: zh/_includes/footer-links.md -->
- - -

<div class="borderless-table">

#|
||
实用链接

- [演示计数器](https://metrica.yandex.com/r/dashboard?)
- [添加计数器](https://metrica.yandex.com/add/)
- [免费计数器设置](https://yandex.com/promo/freeservice/metrica?utm_source=help_metrica_en&utm_medium=cpc&utm_campaign=1)
- [Yandex Metrica API](https://tech.yandex.com/metrika/)
- [提出您的想法](https://yandex.com/support/metrica/troubleshooting/idea.html)
|
线上培训



- [参加培训课程](https://yandex.com/adv/edu/online/metrika?utm_source=metrika_help&utm_medium=web&utm_campaign=static&utm_content=useful_links)

||
|#

</div>

<!-- source: zh/_includes/styles/table-style.md -->

<!-- endsource: zh/_includes/styles/table-style.md -->
<!-- endsource: zh/_includes/footer-links.md -->

<!-- source: zh/_includes/styles/table-style.md -->

<!-- endsource: zh/_includes/styles/table-style.md -->
