Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Magento & Google Analytics eCommerce Tracking <<SOLVED>>
 
Etasker
Member
 
Total Posts:  54
Joined:  2008-07-17
Denmark
 

I have now download the subversion of the new version of Magento with the fix from the team at: http://www.magentocommerce.com/svn

And replaced the files regarding Google Analytics.

Looking forward to see if it has been fixed.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Etasker
Member
 
Total Posts:  54
Joined:  2008-07-17
Denmark
 

It worked.

 
Magento Community Magento Community
Magento Community
Magento Community
 
SCompany
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2009-09-17
 

As did it here!
Traffic data shows up again!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Kezako
Jr. Member
 
Total Posts:  1
Joined:  2009-11-08
 
viovao - 19 April 2010 01:24 AM

I have now download the subversion of the new version of Magento with the fix from the team at: http://www.magentocommerce.com/svn

And replaced the files regarding Google Analytics.

Looking forward to see if it has been fixed.

which files you must replace ?
How download these files?

 
Magento Community Magento Community
Magento Community
Magento Community
 
SCompany
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2009-09-17
 

Navigate to a temporary folder you wish to use and execute the following code:

svn checkout http://svn.magentocommerce.com/source/branches/1.4-trunk
And then just copy these files from the 1.4-trunk
app/code/core/Mage/GoogleAnalytics
and
app/design/frontend/base/default/layout/googleanalytics.xml
 
Magento Community Magento Community
Magento Community
Magento Community
 
gattire
Jr. Member
 
Avatar
Total Posts:  9
Joined:  2010-02-21
 

I tried to simply ‘switch on’ Google analytics in admin section but that didn’t work for me.

I manually added the code provided, to the links page below and it worked fine -
app/design/frontend/default/default/template/page/template/links.phtml

if this doesn’t work try the footer page also

hope this helps.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mikegps
Jr. Member
 
Total Posts:  5
Joined:  2010-01-01
 
Cubix Web Solutions - 14 December 2009 04:19 AM

Hi Dustin

As I said earlier, Magento already has Google ANalytics ecommerce tracking built in on the success page and works by default.

Since yours is not working, the only possibility is that
1. Google analytics is not set up correctly. You mentioned it is already set up correctly.
2. Some code must have been changed by you on the success page which has broken this functionality

To check whether the functionality has been broken or not,
1. Buy a product which will lead to your site’s success page, which I presume must be http://whisphersandroses.com/store/checkout/onepage/success/
2. VIew the source of the success page and at the bottom of the source file, check whether google analytics ecommerce tracking code is available or not. As an example, this might be there on the source of the success page of a lens selling website:

<script type="text/javascript">
//<![CDATA[
pageTracker._addTrans("100000346","","450.7440","0.0000","0.0000","London","London","GB");
pageTracker._addItem("100000346","CPMPSB","Complete Multi-Purpose Solution","","14.2125","4.0000");
pageTracker._addItem("100000346","FCDP30-BC8.7-DI14.0-PO-4.50","Focus Dailies AquaComfort Plus","","0.4722","360.0000");
pageTracker._addItem("100000346","FCDP30-BC8.7-DI14.0-PO-3.50","Focus Dailies AquaComfort Plus","","0.4722","360.0000");
pageTracker._addItem("100000346","FCDL30-BC8.6-DI13.8-PO-4.00","Focus Dailies All Day Comfort","","0.2997","90.0000");
pageTracker._addItem("100000346","FCDL30-BC8.6-DI13.8-PO-2.25","Focus Dailies All Day Comfort","","0.2997","90.0000");
pageTracker._trackTrans();
//]]></script>

It gives info about order no., sku, product name, etc.

If this is not there in the source file means you have broken the Google analytics code. If this is there, means you have not correctly configured google analytics. If you have configured Google analytics correctly then you need a developer to sort this puzzle!

P.S. We are a development company rasberry

Cheers

- Harshit

Checked the solutions you suggested....

Analytics Code IS installed correctly on both Magento and GA in my case.  Magento V1.3.2.4 suddenly stopped reporting transaction data when clicking on the TRANSACTION link in GA. Just says “There is no data for this view”.

Checked my checkout/success page and data is there ready to be passed. Checked GA and ecommerce is showing the number of transactions and average amount. Only clicking the transactions shows no data now.

Any suggestions??

 
Magento Community Magento Community
Magento Community
Magento Community
 
Anna Perena
Member
 
Total Posts:  41
Joined:  2008-06-07
 

Updating to the trunk version of the analytics implementation worked for me grin visits and sales are being tracked!

Currently only the following 3 files are changed in the trunk version of /app/code/core/Mage/GoogleAnalytics
/app/code/core/Mage/GoogleAnalytics/Block/Ga.php
/app/code/core/Mage/GoogleAnalytics/Model/Observer.php
/app/code/core/Mage/GoogleAnalytics/etc/system.xml

Right click to save link as then upload to correct locations.

/Block/Ga.php adds the missing

var _gaq _gaq || [];

/Model/Observer.php swaps line 59:

$analyticsBlock->setQuote($quote);
for
if ($quoteId == $quote->getId()) {
                $analyticsBlock
->setQuote($quote);
            
else {
                $analyticsBlock
->setQuote($quoteId);
            
}

and /etc/system.xml just capitalises the ‘N’ in ‘Account number’ in the backend (so not a biggy really)

N.B. /app/design/frontend/base/default/layout/googleanalytics.xml is unchanged (with reference name="after_body_start")

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ross
Guru
 
Avatar
Total Posts:  336
Joined:  2007-08-31
Scarborough, North Yorkshire, UK
 

Something I think should be mentioned…

If when you view the source on your page there is NO analytics code at all, you need to be aware of the following.

From 1.3 to 1.4 the default page templates have been update to include this line:

<?php echo $this->getChildHtml('after_body_start'?>

This line should be added in to these files in the template/page folder (just after the starting <body> tag)
1column.phtml
2columns-left.phtml
2columns-right.phtml
3columns.phtml

This is because the layout file for Google Analytics references “after_body_start” for outputing the code.

Cheers,
Ross.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ceefour
Member
 
Avatar
Total Posts:  52
Joined:  2008-09-16
Bandung, Indonesia
 
Ross - 27 May 2010 04:22 AM

From 1.3 to 1.4 the default page templates have been update to include this line:

<?php echo $this->getChildHtml('after_body_start'?>

This line should be added in to these files in the template/page folder (just after the starting <body> tag)
1column.phtml
2columns-left.phtml
2columns-right.phtml
3columns.phtml

This is because the layout file for Google Analytics references “after_body_start” for outputing the code.

THANK YOU SO MUCH ROSS!

The above quote is true, in addition I had to modify page.xml to include the following blocks ("after_body_start" and “global_notices"):

...
                <
action method="addCss"><stylesheet>css/print.css</stylesheet><params>media="print"</params></action>
            </
block>

            <
block type="core/text_list" name="after_body_start" as="after_body_start"/>

            <
block type="page/html_notices" name="global_notices" as="global_notices" template="page/html/notices.phtml" />

            <
block type="page/html_header" name="header" as="header">
...

After doing that, though, I decided to remove layout/page.xml entirely from my theme (so it inherits from base_default).

A different issue but may help someone, is CSS. Since Magento 1.3 had reset.css and clears.css, in the theme for Magento 1.4 I just CSS-imported them for a quick fix, in styles.css:

/* Quick fix from Magento 1.3 CSS files */
@import url("reset.css");
@
import url("clears.css");
 
Magento Community Magento Community
Magento Community
Magento Community
 
Ben Marks
Guru
 
Avatar
Total Posts:  452
Joined:  2008-10-09
Charleston, SC
 

Yep, Ross is right - we noticed this as well.  re: http://www.magentocommerce.com/boards/viewreply/240114/
I don’t recall seeing obvious notices regarding the new block in the main layout, would be nice to have these sorts of changes broadcast a bit more obviously.  This was also an issue when the form key was added a few versions back.

Dave B. has a solid resolution to this issue as well. http://www.magentocommerce.com/boards/viewreply/234338/

 
Magento Community Magento Community
Magento Community
Magento Community
 
weatherfront
Jr. Member
 
Total Posts:  30
Joined:  2009-10-07
 

I hoped this might solve a problem but it hasn\’t.

Using 1.4.0.1 with and without the latest GoogleAnalytics from 1.4-trunk.

When a new customer registers and account the information is not collected and passed to GA.

This renders use of Magento with GA almost useless as any ecommerce reports are incomplete.

It is an issue that is discussed elsewhere;

http://www.magentocommerce.com/boards/viewthread/176351/

I have tried the Hacks suggested but it makes no difference.

 
Magento Community Magento Community
Magento Community
Magento Community
 
betterbatt
Member
 
Total Posts:  53
Joined:  2009-09-16
 
vmadmin - 03 November 2009 01:02 PM

@cellfservices
No, that will not work. The HTML/Javascript code Google gives you should not be used to replace the PHP code in “Ga.php”.

Magneto already supports GA tracking, including ecommerce tracking. The “Ga.php” file generates the proper (HTML/Javascript) code for you. All you have to do is turn on GA tracking and enter your GA account number (something like “UA-XXXXX-X").

That said… the tracking is working fine for me with the exception of ecommerce categories.
http://www.magentocommerce.com/boards/newreply/52505/

Using Magento 1.3 we could track all eccomerce data. We upgraded to 1.4 and can track visitors but only about 1% of eccomerce data comes through. Anyone know how to solve this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
betterbatt
Member
 
Total Posts:  53
Joined:  2009-09-16
 
Dave B - 05 May 2010 02:21 AM

Updating to the trunk version of the analytics implementation worked for me grin visits and sales are being tracked!

Currently only the following 3 files are changed in the trunk version of /app/code/core/Mage/GoogleAnalytics
/app/code/core/Mage/GoogleAnalytics/Block/Ga.php
/app/code/core/Mage/GoogleAnalytics/Model/Observer.php
/app/code/core/Mage/GoogleAnalytics/etc/system.xml

Right click to save link as then upload to correct locations.

/Block/Ga.php adds the missing

var _gaq _gaq || [];


/Model/Observer.php swaps line 59:
$analyticsBlock->setQuote($quote);
for
if ($quoteId == $quote->getId()) {
                $analyticsBlock
->setQuote($quote);
            
else {
                $analyticsBlock
->setQuote($quoteId);
            
}

and /etc/system.xml just capitalises the ‘N’ in ‘Account number’ in the backend (so not a biggy really)

N.B. /app/design/frontend/base/default/layout/googleanalytics.xml is unchanged (with reference name="after_body_start")

Sorry didn’t see all the other pages to read through. We already tried the changes to GA.php but didn’t know about the changes needed to Observer.php. Have changed that file and will report if eccomerce tracking is working again in a couple of days. Hope so.

 
Magento Community Magento Community
Magento Community
Magento Community
 
betterbatt
Member
 
Total Posts:  53
Joined:  2009-09-16
 
Dave B - 05 May 2010 02:21 AM

N.B. /app/design/frontend/base/default/layout/googleanalytics.xml is unchanged (with reference name="after_body_start")

Dave, we have our googleanalytics.xml set to before_body_end. Are you saying it should be after_body_start to function correctly?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top