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 4
setting up conversion goal for google analytics
 
dr.colossus
Jr. Member
 
Avatar
Total Posts:  6
Joined:  2008-05-06
 

I couldnt find an answer to this on here for a standard magento install, so I set it up myself.

I think its right, if not ill find out in the next few days and update here. If someone knows a better way, post it here.

Goal URL - /checkout/onepage/success/

Funnel Pages ;
Step 1 /checkout/cart/
Step 2 /checkout/onepage/

Pretty simple ay. (I think).
Peas out.
Danno

 
Magento Community Magento Community
Magento Community
Magento Community
 
edesigninc
Jr. Member
 
Avatar
Total Posts:  17
Joined:  2008-03-14
Fresno, CA
 

Yes but this is an incomplete funnel, a better funnel would include each part of the checkout steps.

Registration
Billing Information
Shipping Information
Payment Information
Confirmation
Successful Purchase

Without the complete picture you won’t have a good idea of where your customers are getting lost in the checkout process.

-Eric

 
Magento Community Magento Community
Magento Community
Magento Community
 
edesigninc
Jr. Member
 
Avatar
Total Posts:  17
Joined:  2008-03-14
Fresno, CA
 

By editing the files in app/design/frontend/default/default/template/checkout/onepage/
and adding a Javascript trigger event for the Google Goal conversion on each onclick event for the checkout steps:

<button class="form-button right” onclick="billing.save();pageTracker._trackPageview(’/checkout/billing_information’);"><span><?php echo $this->__('Continue') ?></span></button>

You can track a create and track a more precise Google Goal Funnel of the checkout process.

Don’t forget to add the Google code to the top of the cart.phtml page.

var gaJsHost = (("https:" == document.location.protocol) ? “https://ssl.” : “http://www.");
document . write(unescape("&#x3C;script src=’” + gaJsHost + “google-analytics.com/ga.js’ type=’text/javascript’&#x3E;&#x3C;/script&#x3E;"));
var pageTracker = _gat._getTracker("UA-XXXXXX-XX");
pageTracker._initData();

 
Magento Community Magento Community
Magento Community
Magento Community
 
joff
Jr. Member
 
Total Posts:  27
Joined:  2008-06-27
 

Very helpful edesigninc. These adaptations worked great for me. Is it possible that these pages could get overwritten with a future Magento upgrade and wipe out my Google Analytics additions?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Christian_Norway
Sr. Member
 
Total Posts:  135
Joined:  2008-06-18
 

Hi

I am trying to set up Google Goal Conversions as well.

But I’m not sure I understand edesigninc’s explaination correctly:

Step 1:

Add Google code to the top of cart.phtml
Should this code be entered like below, or is this now entered by standard in Magento throught the backend?

<script>
var 
gaJsHost = (("https:" == document.location.protocol) ? â€œhttps://ssl.” : â€œhttp://www."); 
document write(unescape("&#x3C;script src=’” + gaJsHost + â€œgoogle-analytics.com/ga.js’ type=’text/javascript’&#x3E;&#x3C;/script&#x3E;")); 
var 
pageTracker _gat._getTracker("UA-XXXXXX-XX"); 
pageTracker._initData();
</script>

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE

Step 2:

Add js trigger on forum-button for the files. - billing.phtml - shipping.phml - payment.phtml

<button class="form-button right" onclick="shipping.save();pageTracker._trackPageview(’/checkout/shipping_information’);"><span><?php echo $this->__('Continue'?></span></button>

Questions:

How to add the code to success.phtml ?

How to add the code to registration ? Where is the registration file?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Christian_Norway
Sr. Member
 
Total Posts:  135
Joined:  2008-06-18
 

Can anyone help with this issue?

 
Magento Community Magento Community
Magento Community
Magento Community
 
pumba
Jr. Member
 
Total Posts:  28
Joined:  2008-05-14
 

Was anybody able to make it work?

I added code to onclick section as shown below:

<button class="form-button right” onclick="billing.save();pageTracker._trackPageview(’/checkout/billing_information’);"><span><?php echo $this->__('Continue') ?></span></button>

but now my button is unclickable - nothing happens if you click on it :(

 
Magento Community Magento Community
Magento Community
Magento Community
 
pumba
Jr. Member
 
Total Posts:  28
Joined:  2008-05-14
 

oops.. silly me…

it works… I just need to use proper quotes (not backtics) in

pageTracker._trackPageview(’/checkout/billing_information’);">

 
Magento Community Magento Community
Magento Community
Magento Community
 
lanthaler
Jr. Member
 
Total Posts:  1
Joined:  2009-02-16
 

That method is not really correct. You track the page when a user is leaving it and not when he loads it.
An easier and more reliable way to do that is to change opcheckout.js.

Just replace

gotoSection: function(section)
    
{
        section 
= $('opc-'+section);
        
section.addClassName('allow');
        
this.accordion.openSection(section);
    
},

(starts at line 88) with

gotoSection: function(section)
    
{
        
try {
            pageTracker
._trackPageview('/checkout/' section '/');
        
catch(err{}

        section 
= $('opc-'+section);
        
section.addClassName('allow');
        
this.accordion.openSection(section);
    
},
 
Magento Community Magento Community
Magento Community
Magento Community
 
J_T_
Mentor
 
Avatar
Total Posts:  1961
Joined:  2008-08-07
London-ish, UK
 

lanthaler, could you please elaborate on that?

Does your code not require any further button-based edits?

In other words, is your opcheckout.js edit suggestion all that is required if we have Analytics enabled or do we still add Google code anywhere?

 
Magento Community Magento Community
Magento Community
Magento Community
 
FOOMAN
Guru
 
Avatar
Total Posts:  669
Joined:  2007-12-13
Auckland, New Zealand
 

Hi everyone,

We have just updated our GoogleAnalyticsPlus extension and we think we found a solution for tracking the individual sections of the checkout process without the need to change any template files.

The idea is to add an event listener waiting for a successful AJAX request. It then takes the corresponding url and posts it to Google Analytics. This is the relevant code I used:

if(Ajax.Responders){
    Ajax
.Responders.register({
      onComplete
: function(response){
        
if(!response.url.include("progress")){
            pageTracker
._trackPageview(response.url);
        
}
      }
    }
);
}

Currently this will work across the whole site and will trigger a trackPageview for every AJAX request.

Please note that we haven’t yet tested this extensively and I am hoping people can help me in beta testing this feature. I am looking forward to your feedback.

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Armen
Member
 
Total Posts:  46
Joined:  2008-05-06
Los Angeles
 

Hey I just wanted to reply that I added the code from Fooman’s post to my opcheckout.js initialize function and it seems to work beautifully. I’m on Magento 1.2.1. This is great to be able to get a more granular view of the customer’s progress through the checkout funnel.

 
Magento Community Magento Community
Magento Community
Magento Community
 
FOOMAN
Guru
 
Avatar
Total Posts:  669
Joined:  2007-12-13
Auckland, New Zealand
 

Hi Armen, thanks for the feedback.

And just to clarify: with my posted extension you don’t need to edit any files. If you are happy to edit opcheckout.js using the method posted by lanthaler a few posts up is the better approach. Just make sure that when you update Magento to a new version it is still there.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Armen
Member
 
Total Posts:  46
Joined:  2008-05-06
Los Angeles
 

Hey Fooman, I know about the extension but its in beta and also there’s a couple other changes in there that I am not completely sure I understand what they are or what they change so I wanted to avoid them for now.

Why do you say that lanthaler’s approach is a better one? Because it does a try/catch? Because I guess that could be added to your version easily as well. Or another reason?

 
Magento Community Magento Community
Magento Community
Magento Community
 
FOOMAN
Guru
 
Avatar
Total Posts:  669
Joined:  2007-12-13
Auckland, New Zealand
 

With lanthaler’s approach you send off the Google pagetrack event directly in the code where and when it happens. My code waits for a completed AJAX event and then fires off the event.

The downside to changing opcheckout.js is that you need to change a core file. Since you can’t overwrite/replace a core file with an extension I took the “detour” of listening for a completed AJAX event.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Armen
Member
 
Total Posts:  46
Joined:  2008-05-06
Los Angeles
 

Are the files in a skin considered core files too? I dont know. I don’t mind over writing those. I keep a list of things I change in places like app/code/core/Mage to re-do in case of an upgrade. I haven’t kept track of the many CSS changes I have made in the skin however.

Plus it seems like a better idea to wait for the Ajax request to complete successfully before marking that they moved past that step. I think I’ll stick with what I have for now but thanks for your input.

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