By default, Anaraky Google Dynamic Remarkting Tag (“Anaraky GDRT”) does not set correct page type “other“, as described in Google’s Dynamic Remarketing guidelines. Instead, it uses “siteview“. To overcome this behavior there are only 2 simple modifications required.
Required modifications for Anaraky Gdrt extension
First, in
app/code/community/Anaraky/Gdrt/Block/Script.php on line 51 replace siteview by other:
$params = array('ecomm_pagetype' => 'siteview');
becomes
$params = array('ecomm_pagetype' => 'other');
Second, in the same file on line 104 replace
$params = array( 'ecomm_pagetype' => 'siteview' );
with
$params = array( 'ecomm_pagetype' => 'other' );
Hint on using Anaraky custom page setup
Furthermore, when using the custom page setup options make sure to omit the trailing slash when only specifying module/controller setup, e.g. checkout/cart as shown below:
Anaraky Google Dynamic Remarkting Tag does string comparison check without the trailing slash in the observer class:
foreach ($gdrtPages as $k => $v) { $v = rtrim($v, '/'); if ($mName . '/' . $cName . '/' . $aName == $v || $mName . '/' . $cName == $v) { $pageType = $k; } }
Handling special prices and grouped/bundle products for “ecomm_totalvalue”
In case you run into problem when displaying special prices or handling grouped or bundle products in the ecomm_totalvalue field here is a quick fix to add this check. Add the following function in Script.php:
private function _getProductPrice($product) { $totalvalue = 0; // check if we are handling grouped products if($product->getTypeId() == 'grouped') { $groupedSimpleProducts = $product->getTypeInstance(true)->getAssociatedProducts($product); $groupedPrices = array(); foreach($groupedSimpleProducts as $gSimpleProduct) { $groupedPrices[] = $this->_getProductPrice($gSimpleProduct); } $totalvalue = min($groupedPrices); } else { // handle other product types $_price = Mage::helper('tax')->getPrice($product, $product->getPrice(), $inclTax); $_specialPrice = Mage::helper('tax')->getPrice($product, $product->getSpecialPrice(), $inclTax); $_finalPrice = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), $inclTax); if($_price == $_finalPrice) { // no special price $totalvalue = (float)$_price; } else { // get special price if((float)$_finalPrice > 0 && (float)$_finalPrice <= (float)$_price) { $totalvalue = (float)$_finalPrice; } else { $totalvalue = (float)$_price; } } } return $totalvalue; }
Second, change the “product” case like so:
case 'product': $product = Mage::registry('current_product'); $totalvalue = $this->_getProductPrice($product); $params = array( 'ecomm_prodid' => $this->getEcommProdid($product), 'ecomm_pagetype' => 'product', 'ecomm_totalvalue' => (float)number_format($totalvalue, '2', '.', '') ); unset($product); break;
Don’t forget to flush the cache afterwards.