ongeremd.com

Blog over het Fine tunen van website, webshops en Content management systemen

Magento store en google analytics update probleem 1.4.1

Magento webshops hebben gelijk al een mogelijkheid om google analytics te integreren.
Google analytics is een belangrijke tool die het gedrag van uw bezoekers analyseert.
Bezoekers gedrag is belangrijke informatie die u in staat stelt kleine aanpassingen te maken in uw webshop waardoor uw omzet kan verbeteren.

Doordat magento altijd bezig is met nieuwe updates komt het soms voor dat sommige dingen niet meer werken na een update .
Dit is ook gebeurt tijdens de magento update van versie 1.4.0 naar versie 1.4.1

Google analytics werkt niet meer optimaal en heeft een kleine aanpassing nodig.
Deze aanpassing is reeds verwerkt in de komende magento update..

Om het probleem zelf op te lossen doe je het volgende:

Browse naar en open app/code/core/Mage/GoogleAnalytics/Block/Ga.php.

Hier vind u de volgende code:

<!– BEGIN GOOGLE ANALYTICS CODE –>
<script type=”text/javascript”>

//<![CDATA[
(function() {
var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;
ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';
(document.getElementsByTagName(\'head\')[0] || document.getElementsByTagName(\’body\’)[0]).appendChild(ga);
})();

_gaq.push(["_setAccount", "' . $this->getAccount() . '"]);
_gaq.push(["_trackPageview", "'.$this->getPageName().'"]);
//]]>
</script>
<!– END GOOGLE ANALYTICS CODE –>
‘);

$this->addText($this->getQuoteOrdersHtml());

if ($this->getGoogleCheckout()) {
$protocol = Mage::app()->getStore()->isCurrentlySecure() ? ‘https’ : ‘http’;
$this->addText(’<script src=”‘.$protocol.’://checkout.google.com/files/digital/ga_post.js” type=”text/javascript”></script>’);
}

return parent::_toHtml();
}

Verander deze code in de volgende:

<!– BEGIN GOOGLE ANALYTICS CODE –>
<script type=”text/javascript”>
//<![CDATA[
(function() {
var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;
ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';
(document.getElementsByTagName(\'head\')[0] || document.getElementsByTagName(\’body\’)[0]).appendChild(ga);
})();

var _gaq = _gaq || [];
_gaq.push(["_setAccount", "' . $this->getAccount() . '"]);
_gaq.push(["_trackPageview", "'.$this->getPageName().'"]);
//]]>
</script>
<!– END GOOGLE ANALYTICS CODE –>
‘);

$this->addText($this->getQuoteOrdersHtml());

if ($this->getGoogleCheckout()) {
$protocol = Mage::app()->getStore()->isCurrentlySecure() ? ‘https’ : ‘http’;
$this->addText(’<script src=”‘.$protocol.’://checkout.google.com/files/digital/ga_post.js” type=”text/javascript”></script>’);
}

return parent::_toHtml();
}
Sla de gewijzigde bestanden op en plaats deze in uw magento installatie.

En klaar is uw google analytics update voor magento 1.4.1.

Bekijk ook

Info

Datum
July 23rd, 2010

Gepost door

Categorie


2 Comments


  1. Anonymous

    Nieuwste versie van magento zal deze handmatige aanpassing overbodig maken.

    Maar tijdelijk is dit een goede oplossing.


  2. This is a fantastic article about style. I’m a student just trying to learn more about web design and I really enjoyed reading it. Keep up the great job!


Leave a Reply