Google Universal Analytics - Enhanced Ecommerce for Magento

Enhanced Ecommerce : Click and Impressions configuration

Note

These modifications are optional! Without it, you will just not have impressions & clicks informations.

You will need to add some modification to your theme if you want to benefit fully the Enhanced Ecommerce plugin. You will find on this page the documentation to manage Product Impressions, Product clicks, Promotion Impressions and Promotions clicks

Product click & impression tracking

You’ll have to add a PHP code whenever a link to a product view is displayed. For example, you’ll want to start with catalog/product/list.phtml template.

To track a product clicks, you’ll have to add this code :

<?php echo Mage::helper(‘googleuniversalanalytics/ecommerce’)->getProductLinkData($_product, false, $_iterator) ?>

The parameters of getProductLinkData method are :

  1. The product. Required. This must be a ‘catalog/product’ model.

  2. The list name. Optional. If you leave it to false, our extension will try to guess a list name. For example : “Category Electronics Product List”.

  3. The position of the product on the list. Optional. On list.phtml template, you will want to use $_iterator variable for list mode, and $i for grid mode.

You have to place this code whenever a link product is displayed in a list, inside the <a> tag, for example :

<a <?php echo Mage::helper(‘googleuniversalanalytics/ecommerce’)->getProductLinkData($_product, false, $_iterator) ?> href=”<?php echo $_product->getProductUrl() ?>” title=”<?php echo $_productNameStripped; ?>”>

Promo click & impression tracking

You’ll have to add a PHP code whenever a link to a promo is displayed.

To track a promo clicks, you’ll have to add this code :

<?php echo Mage::helper(‘googleuniversalanalytics/ecommerce’)->getPromoLinkData(‘PROMO12’, ‘Summer Sale’, ‘sbanner2’, ‘banner_slot1’) ?>

The parameters of getPromoLinkData method are :

  1. The promotion ID. Required.

  2. The promotion name. Optionnal.

  3. The creative associated with the promotion (e.g. summer_banner2).

  4. The position of the promotion. Optionnal.

You have to place this code whenever a link to promo is displayed, inside the <a> tag, for example :

<a <?php echo Mage::helper(‘googleuniversalanalytics/ecommerce’)->getPromoLinkData(‘PROMO12’, ‘Summer Sale’, ‘sbanner2’, ‘banner_slot1’) ?> href=”<?php echo $this->getUrl(‘promotions’) ?>” title=”<?php echo $this->__(‘Summer Sales !’); ?>”>

Notes You may want to factorize this code to get it more clean, and shorter. For example, you can add this code oo the top of your template :

$_guaEc = Mage::helper(‘googleuniversalanalytics/ecommerce’);

So you can replace Mage::helper(‘googleuniversalanalytics/ecommerce’) with $_guaEc in the codes above, for example :

<?php echo Mage::helper(‘googleuniversalanalytics/ecommerce’)->getPromoLinkData(‘PROMO12’, ‘Summer Sale’, ‘sbanner2’, ‘banner_slot1’) ?>

will become :

<?php echo $_guaEc->getPromoLinkData(‘PROMO12’, ‘Summer Sale’, ‘sbanner2’, ‘banner_slot1’) ?>

Better, isn’t it ?

Finally, we are sorry to put your hands into the code, it should be our job! However, we cannot detect all your promotions, and product’s impressions/links :) Especially since you have a very customized (and so beautiful) theme, right ?

We hope our extension will help you in your business! Cheers!