谁有Prestashop集成GTM电子商务分析经验

问题描述 投票:0回答:1

我正在尝试使用Google跟踪代码管理器设置电子商务跟踪但是我无法将数据显示在Google Analytics中?在header.tpl中使用此类代码

{if isset($page_name) && $page_name|escape:'html':'UTF-8' == "order-confirmation"}
    <script type="text/javascript">
    window.dataLayer = window.dataLayer || []
    dataLayer.push({ldelim}
       'transactionId': '{$id_order}',
       'transactionTotal': {$total_paid_tax_incl},
       'transactionProducts': [
       {foreach from=$products item=product}
           {ldelim}                            
           // List of productFieldObjects.
               'sku': '{$product.id}',
               'name': '{$product.name}',     // Name or ID is required.
               //'category': '{$product.X}',
               'price': {$product.price},
               'quantity': 1                        // Optional fields may be omitted or set to empty string.
           {rdelim}
           {if !$smarty.foreach.product.last},{/if}
       {/foreach}
    ]
    {rdelim});
    </script>

{/如果}

但没有任何作用

google-analytics e-commerce prestashop-1.7
1个回答
0
投票

您的数据层声明需要高于GTM代码段。

GTM的noscript部分也应该紧接着。

我认为你应该查看文档,因为你有其他实现问题:

如何安装GTM:https://support.google.com/tagmanager/answer/6103696?hl=en&ref_topic=3441530

GTM的电子商务:https://support.google.com/tagmanager/answer/6107169?hl=en

© www.soinside.com 2019 - 2024. All rights reserved.