首页 > 解决方案 > 增强型电子商务 - Magento 产品点击

问题描述

您好,我在 GA 上启用了增强型电子商务,并使用 select_content 来跟踪产品点击。

select_content 是实时显示的,但是当我点击它时什么都没有显示。

这是我的代码

<?php 
    $sku ="";
    $productname ="";
    $productcategory ="";

    $current_product = Mage::registry('current_product');
    $_category_detail=Mage::registry('current_category');

    if($current_product) {
        $sku = $current_product->getSku();
        $productname = $current_product->getName();
        $productcategory = $_category_detail->getName();;
    }

?>

<script>

    gtag('event', 'select_content', {
      "content_type": "product",
      "items": [
        {
          "id": "<?php echo $sku; ?>",
          "name": "<?php echo $productname; ?>",
          "list_name": "Search Results",
          "category": "<?php echo $productcategory; ?>"
        }
      ]
    });

</script>

事件类别显示为参与,事件操作显示为 select_content。当我点击参与时 - 操作是 select_content 并且事件标签是产品。没有产品列表。

有人可以帮忙吗?

标签: magentogoogle-analytics

解决方案


推荐阅读