Posted on 4 Comments

Fix Anaraky Google Dynamic Remarkting Tag extension

Magento Logo

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 Gdrt Magento Extension

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.

Posted on Leave a comment

Google Maps update fails on HTC smartphone

Android Robot Logo

Recently I wanted to upgrade Google Maps on my HTC Desire running Android 2.3.3. Unfortunately the update kept failing with the following error

failed to download update…

After several attempts to restart the download process I gave up and restarted the phone and tried again – without success. Then I realized that the automatic update was enabled for this app. So, I disabled it, restarted the phone and the update process – with success!

I have reproduced this problem on a HTC Wildfire and a HTC Legend using different Android versions. It seems like the latest version of Google Maps requires the automatic update to be disabled to run the update? At least it worked this way and I have enabled the automatic update again – let’s see if it works out of the box for the next update. UPDATE: Today another update became available, so I tried my luck. Unfortunately, I had to disable the automatic update, restart the phone and run the update manually again.