Tij Bedi
Total Posts: 11
Joined: 2008-12-31
Anybody know why this is happening or has a fix for it?
I have tried going properly through category menu’s to buy a product but the Google API code that get inserted automatically on the final success page never has the category in it
pageTracker._addItem("100000018”,"00XXXX”,"シリマリン・ミルクシスル 175mg”,"”,"1840.0000”,"1.0000");
Any help would be appreciated.
Posted: August 19 2009
| top
coldwired
Total Posts: 19
Joined: 2008-07-16
Hi,
We’ve got the same problem here. Did you find a solution to this?
Thanks,
Colin.
Posted: September 2 2009
| top
| # 1
vmadmin
Total Posts: 11
Joined: 2009-05-13
I am having the same problem. The category argument is always an empty string.
pageTracker . _addItem ( "100000105" , "15BZ" , "My Product" , "" , "1.9500" , "1.0000" );
I took a look at /app/code/core/Mage/GoogleAnalytics/Block/Ga.php
On line 112-119 (in version 1.3.2.4) the category should be getting inserted into the tracking. It wasn’t intentionally omitted.
$html .= 'pageTracker._addItem(' ; $html .= '"' . $order -> getIncrementId () . '",' ; $html .= '"' . $this -> jsQuoteEscape ( $item -> getSku (), '"' ) . '",' ; $html .= '"' . $this -> jsQuoteEscape ( $item -> getName (), '"' ) . '",' ; $html .= '"' . $item -> getCategory () . '",' ; $html .= '"' . $item -> getBasePrice () . '",' ; $html .= '"' . $item -> getQtyOrdered () . '"' ; $html .= ');' . "\n" ;
I’m guessing that getCategory is supposed to return an integer rather than a category name since it isn’t being run through “jsQuoteEscape”.
The getCategory method is returning NULL.
Posted: November 3 2009
| top
| # 2
vmadmin
Total Posts: 11
Joined: 2009-05-13
This topic should be moved to Technical Issues .
I’m running 1.3.2.4 from a fresh install and having this issue.
Posted: November 4 2009
| top
| # 3
vmadmin
Total Posts: 11
Joined: 2009-05-13
Solution:
IN short:
Magento sucks use something else
IN Long:
/app/code/core/Mage/GoogleAnalytics/Block/Ga.php
Change this at line 106:
foreach ($order->getAllItems() as $item) {
if ($item->getParentItemId()) {
continue;
}
$cProduct = Mage::getModel(’catalog/product’);
$cProductId = $cProduct->getIdBySku($item->getSku());
$cProduct->load($cProductId);
$category_list = “”;
$cats = $cProduct->getCategoryCollection()->exportToArray();
foreach($cats as $cat){
$category_list .= Mage::getModel(’catalog/category’)->load($cat[’entity_id’])->getName()."|";
}
$category_list = rtrim($category_list,"|");
$html .= ‘pageTracker._addItem(’;
$html .= ‘”’ . $order->getIncrementId() . ‘“,’;
$html .= ‘”’ . $this->jsQuoteEscape($item->getSku(), ‘“‘) . ‘“,’;
$html .= ‘”’ . $this->jsQuoteEscape($item->getName(), ‘“‘) . ‘“,’;
$html .= ‘”’ . $category_list . ‘“,’;
$html .= ‘”’ . $item->getBasePrice() . ‘“,’;
$html .= ‘”’ . $item->getQtyOrdered() . ‘“‘;
$html .= ‘);’ . “\n”;
}
Will display all the categories a product is in separated by a “|” symbol
Posted: November 11 2009
| top
| # 4
willamm
Total Posts: 6
Joined: 2009-12-20
allowScriptAccess is set to always. What troubles me is that it appears there must be
access to the DOM since utmp contains the whole pageview in Firefox 3, but in IE it’s
just blank.
_________________
Download Windows 7
Posted: January 19 2010
| top
| # 5
heronfisher
Total Posts: 4
Joined: 2010-03-12
Probably the above posted comment would work as this kind of problems are now very among the Google Analytics user.
Signature
m3 zero
Posted: March 19 2010
| top
| # 6
rubaducky
Total Posts: 39
Joined: 2009-10-02
I tried the above code and it still didn’t work.
Anyone figure out how to add the category to analytics?
magento 1.3.2.4
Posted: August 24 2010
| top
| # 8
subsidies
Total Posts: 2
Joined: 2010-10-06
Yes I agree, it still doesn’t work. Anyone has a solution?
Posted: October 6 2010
| top
| # 9
subsidie
Total Posts: 6
Joined: 2010-09-30
Sorry it works fine, my mistake :(
Signature
wga premie
Posted: October 22 2010
| top
| # 10
coolio
Total Posts: 18
Joined: 2010-02-10
I have a issue that google somehow never picks up the conversion when a persons checkout all the way, so my official conversion is 0 even-though i know that is the case.
Signature
Stadium Cups and Koozies
Posted: December 14 2010
| top
| # 11
mmabardy
Total Posts: 67
Joined: 2010-07-09
@ vmadmin
I would like to try your fix. You say change line in 106 but you dont indicate what to change it from. Can you post all of the code that needs to be changed or let me know if I am right here. Am I to change all of this:
foreach ( $order -> getAllItems () as $item ) { if ( $item -> getParentItemId ()) { continue; } $html .= '_gaq.push(["_addItem",' ; $html .= '"' . $order -> getIncrementId () . '",' ; $html .= '"' . $this -> jsQuoteEscape ( $item -> getSku (), '"' ) . '",' ; $html .= '"' . $this -> jsQuoteEscape ( $item -> getName (), '"' ) . '",' ; $html .= '"' . $item -> getCategory () . '",' ; $html .= '"' . $item -> getBasePrice () . '",' ; $html .= '"' . $item -> getQtyOrdered () . '"' ; $html .= ']);' . "\n" ; } $html .= '_gaq.push(["_trackTrans"]);' . "\n" ; $html .= '//]]>' ; $html .= '</script>' ; return $html ; }
...to what you have posted?
Thank you!
Tusher Khan
Total Posts: 66
Joined: 2011-01-07
Google Analytics code is already installed in Magento. You need to get only the Account number from your google analytics. You can easily include Google Analytics in your Magento store from admin.
Here is a simple way to do that:
http://www.xpressbangla.com/how-to-add-google-analytics-on-magento-from-admin/
Posted: January 17 2012
| top
| # 13