I am trying to implement dynamic re-marketing for an eCommerce website. I made all the editions in the code to call dynamic values, but still this code doesn't seem to work. I am getting an error "We haven't detected custom parameters for Retail (Google Analytics)" in AdWords.
This is the code-
<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>