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

Page 1 of 3
Google Analytics not working and Spoke with Google. 
 
Danielc1234
Sr. Member
 
Avatar
Total Posts:  175
Joined:  2008-01-09
Miami, FL - United States
 

Not sure if this is a bug or not, but when I enter my Google Analytic number, etc. into Magento, Google cannot verify.
I spoke with a tech at Google and he told me the coding is wrong within Magento.
Is there a way around this or is there a fix to this problem?

 
Magento Community Magento Community
Magento Community
Magento Community
 
sherrie
Moderator
 
Avatar
Total Posts:  1655
Joined:  2007-12-14
Waterloo, ON
 

Definitely a must fix!  Google Analytics has the best stats I’ve seen.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Danielc1234
Sr. Member
 
Avatar
Total Posts:  175
Joined:  2008-01-09
Miami, FL - United States
 

Can someone point me in the direction of where the code can be found within Magento? Its not in the footer.phtml.
If I knew where that was, I have the script that is the correct script and maybe I can modify it to work.

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
srinigenie
Guru
 
Avatar
Total Posts:  539
Joined:  2008-02-04
 

Did the person at Google tell you what was wrong or gave you some idea where it is going wrong? That would help you log a bug on Magento ...or for others in the community to investigate a bit more...Strange, I am aware of a number of sites already live and am surprised this never came up till now ...have you searched the forums for more threads like this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Danielc1234
Sr. Member
 
Avatar
Total Posts:  175
Joined:  2008-01-09
Miami, FL - United States
 

Yes I have searched high and low on the forums.
I was only told by Google that the script that shows on the source code is not the proper code.
So if I knew where it was programmed, I could hopefully drop in the proper code in place and get it to work.

 
Magento Community Magento Community
Magento Community
Magento Community
 
alanin
Member
 
Total Posts:  67
Joined:  2008-02-25
Nordhausen, Germany
 

the code is in /app/code/core/Mage/GoogleAnalytics/Block/Ga.php in the function _toHtml()

 
Magento Community Magento Community
Magento Community
Magento Community
 
hcristovao
Jr. Member
 
Total Posts:  11
Joined:  2007-10-25
 

@Danielc1234

Were you able to find and fix the problem?

Thanks for any info.

Helder Cristovao
http://www.feesha.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
Stromberg
Member
 
Total Posts:  46
Joined:  2008-02-22
Hessen, Germany
 

hi, i just set up GA and works fine for me...sure you’re using the “new” tracking-code?

 
Magento Community Magento Community
Magento Community
Magento Community
 
etho201
Sr. Member
 
Total Posts:  85
Joined:  2008-04-03
Summerville, SC
 

I’ve noticed that Google Analytics tells you that your account number is XX-XXXXXXX but then when they tell you to paste code to your page they tell you to paste it as XX-XXXXXXX-1… and that worked for me, as soon as I put the -1 at the end of my account number in the Magento admin everything works fine.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tweakmag
Guru
 
Avatar
Total Posts:  307
Joined:  2007-08-31
London, UK
 

the 1 refers to the website id for your account - if you track 3 different sites for example then you would have 3 different numbers at the end. smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
karynn
Member
 
Avatar
Total Posts:  70
Joined:  2008-02-07
 

I updated the \app\code\core\Mage\GoogleAnalytics\Block\Ga.php file and it now seems to be working.

Before

<!-- BEGIN GOOGLE ANALYTICS CODE -->
<
script type="text/javascript">
var 
gaJsHost = (("https:" == document.location.protocol)
"https://ssl." "http://www.");
[removed]("\<script src=\'" gaJsHost
"google-analytics.com/ga.js\' type=\'text/javascript\'>\<\/script>" );
</script>
<script type="text/javascript">
var 
pageTracker _gat._getTracker("' . $this->getAccount() . '");
pageTracker._initData();
pageTracker._trackPageview("' . $this->getPageName() . '");
</script>
<!-- END GOOGLE ANALYTICS CODE -->

After

<!-- BEGIN GOOGLE ANALYTICS CODE -->
<
script type="text/javascript">
var 
gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." "http://www.");
[removed](unescape("&#x3C;script src=\'" gaJsHost "google-analytics.com/ga.js\' type=\'text/javascript\'&#x3E;&#x3C;/script&#x3E;"));
</script>
<script type="text/javascript">
var 
pageTracker _gat._getTracker("' . $this->getAccount() . '");
pageTracker._initData();
pageTracker._trackPageview();
</script>        
<!-- END GOOGLE ANALYTICS CODE -->
 
Magento Community Magento Community
Magento Community
Magento Community
 
Danielc1234
Sr. Member
 
Avatar
Total Posts:  175
Joined:  2008-01-09
Miami, FL - United States
 

Thanks Karynn! I’m gonna give that a try.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Princeanil
Jr. Member
 
Total Posts:  28
Joined:  2008-05-06
 

Thanks, this change enabled google analytics

 
Magento Community Magento Community
Magento Community
Magento Community
 
TechBundle
Member
 
Avatar
Total Posts:  51
Joined:  2008-03-26
 

Google Analytics worked out of the box with version 1.0 for us.

 
Magento Community Magento Community
Magento Community
Magento Community
 
l0st
Member
 
Total Posts:  55
Joined:  2008-04-06
 

yeah, or you can just paste the code in your header.. a bit more simple. I remember seeing this before.. the function to add in your account number.. but.. now.. I cannot find it.

 
Magento Community Magento Community
Magento Community
Magento Community
 
karynn
Member
 
Avatar
Total Posts:  70
Joined:  2008-02-07
 

Ugh, I just noticed I’m getting a JavaScript error in IE7:

Error: ‘_gat’ is undefined

Anyone know a workaround for this? Other than reverting back to the older tracking code?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 3