从网站

时间:2016-01-13 07:31:24

标签: php dynamic google-adwords google-tag-manager

我正在尝试为电子商务网站实施动态再营销。我在代码中创建了所有版本来调用动态值,但这段代码似乎仍无法正常工作。我在AdWords中收到错误消息“我们未检测到零售(Google Analytics)的自定义参数”。

这是代码 -

<script type="text/javascript">

    var google_tag_params = {
ecomm_prodid: '<?php echo get_the_title();?>',
ecomm_pagetype: '<?php 
if(is_page()){
   echo get_the_title()." page"; 
}else{
session_start();
echo $_SESSION['page_type'];

}
?>',
ecomm_totalvalue: '<?php $product = new WC_Product( get_the_ID() );
session_start();
if($_SESSION['page_type']=="Product details page"){
    echo $price = $product->price;
}
session_unset();
session_destroy();

?>',

dynx_itemid: '<?php echo get_the_title();?>',
dynx_pagetype: <?php 
if(is_page()){
   echo get_the_title()." page"; 
}else{
session_start();
echo $_SESSION['page_type'];

}
?>,
dynx_totalvalue: <?php $product = new WC_Product( get_the_ID() );
session_start();
if($_SESSION['page_type']=="Product details page"){
    echo $price = $product->price;
}
session_unset();
session_destroy();

?>,
};
</script>

1 个答案:

答案 0 :(得分:0)

很难看到发生了什么(PHP脚本的HTML输出示例会有所帮助),但我注意到您似乎没有将ecomm_pagetype设置为{{3}之一对于零售网站,即home, searchresults, category, product, cart, purchase, other

之一

此外,ecomm_prodid需要与您的Google Merchant Feed中的产品ID完全一致。

相关问题