osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 
 

Google Analytics e-commerce

This is a discussion on Google Analytics e-commerce within the osCMax v2 Customization/Mods forums, part of the osCMax v2.0 Forums category; I found this contrib on oscommerce: osCommerce Community Add-Ons In the installation file it gives these instructions: How to install ...


Go Back   osCommerce and osCMax shopping cart software forums > osCMax v2.0 Forums > osCMax v2 Customization/Mods

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Reply

 

LinkBack Thread Tools
  #1  
Old 06-30-2008, 06:17 PM
Member
 
Join Date: Aug 2007
Posts: 68
Thanks: 9
Thanked 1 Time in 1 Post
Rep Power: 2
tcshadow is on a distinguished road
Default Google Analytics e-commerce

I found this contrib on oscommerce:

osCommerce Community Add-Ons

In the installation file it gives these instructions:

Quote:
How to install Google Analytics (beta) and E-commerce functionality?

1. create a new directory 'analytics' in catalog/includes/modules/.

result: catalog/includes/modules/analytics/.

2. copy the file 'analytics.php' into this directory.

if necessary, change the $transaction_string and/or the $item_string , for example
if you do not use the value customers_state or affiliation tag, replace this with dummy text (company name description), like:

$transaction_string = '"' . $order_id . '"," ' . $analytics_affiliation . '",
"' . $analytics_total . '","' . $analytics_tax . '","' . $analytics_shipping . '",
"' . $orders['customers_city'] . '","DUMMYTEXT","' . $orders['customers_country'] . '"';

3. make a copy of your original footer.php in the directory catalog/includes/, rename this file to footer-tracker.php.

4. The original contribution placed the Analytics tracking code in the header. A more convient way to place the tracker code, is at the end of the source code.
Therefor: in the ORIGINAL footer.php place the following script at the end of the file

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-xxxxxxx-x");
pageTracker._initData();
pageTracker._trackPageview();
</script>

5. Replace the xxxxxxx-x in the script above with your personal Analytics UA-code (available in your Google Analytics account).

6. open/edit catalog/checkout_success.php.

7. Underneath <link rel="stylesheet" type="text/css" href="style.css"> paste the following code:

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-xxxxxxx-x");
pageTracker._initData();
pageTracker._trackPageview();

<?php
include(DIR_WS_MODULES . 'analytics/analytics.php');
?>

</script>

8. Again (as in step 4), replace the xxxxxxx-x in the script above with your personal Analytics UA-code.

9. At the bottom of the file checkout_success.php change the following line:

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->

into

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer-tracker.php'); ?>
<!-- footer_eof //-->

10. Save the checkout_success.php


Every successful transaction made in your store is now trackable in Google Analytics. Navigate to the e-commerce overview: dashboard -> e-commerce

Q: There is no button "e-commerce" in my Analytics menu
A: E-commerce tracking is not enabled for your website. You can enable this in the profile settings of "Main Website Profile Information". Enable "Yes, an E-Commerce Site" to track your transactions.

Q: Is it necessary to update from Urchin to the new Beta code?
A: To be ahead of mandatory updates, yes. Google announced that the old Analytics Urchin tracking would be supported for at least 12 months.
Can someone familiar with OSCMax translate these install instructions into ones compatible with OSCMax? Obviously because of the template system files such as footer.php no longer exist and as such without proper instructions many people wouldn't know how to install thsi contribution.

I paid someone to do mine but it would also be nice to get feedback on how to do this so that I can check and troubleshoot if it doesn't work properly. Unfortunately with google you're stuck waiting 24 hours between code changes to see if your attempted fix worked or not.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Advertisement
  #2  
Old 06-30-2008, 07:37 PM
Active Member
 
Join Date: Oct 2005
Location: wherever I happen to be at the moment
Posts: 468
Thanks: 4
Thanked 79 Times in 73 Posts
Rep Power: 8
met00 is just really nicemet00 is just really nicemet00 is just really nicemet00 is just really nicemet00 is just really nice
Default Re: Google Analytics e-commerce

footer is replaced with the end of main_page.tpl.php

so anything that goes into footer.php should be at the bottom of main_page.tpl.php
__________________
so endith the lesson
<think>sometimes I just sit's and thinks</think>
"Here you are with a hand full of holes, a thumb up your ass, and a big grin to pass the time of day with." - TWB
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to met00 For This Useful Post:
tcshadow (06-30-2008)
  #3  
Old 07-05-2008, 11:41 AM
MindTwist's Avatar
Active Member
 
Join Date: Jun 2007
Location: Barcelona, Spain
Posts: 346
Thanks: 9
Thanked 27 Times in 26 Posts
Rep Power: 3
MindTwist has a spectacular aura aboutMindTwist has a spectacular aura about
Default Re: Google Analytics e-commerce

tcshadow,
Search the forum. I posted step by step instructions somewhere many months ago on how to install that exact contribution on OSCMAX (except the part where you modify the tracking for sales, but that is exactly the same in OSC and OSCMAX from what I remember)
__________________
MindTwist of Twisted Reality and Twisted Tienda
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 07-06-2008, 02:33 AM
Member
 
Join Date: Aug 2007
Posts: 68
Thanks: 9
Thanked 1 Time in 1 Post
Rep Power: 2
tcshadow is on a distinguished road
Default Re: Google Analytics e-commerce

Quote:
Originally Posted by MindTwist View Post
tcshadow,
Search the forum. I posted step by step instructions somewhere many months ago on how to install that exact contribution on OSCMAX (except the part where you modify the tracking for sales, but that is exactly the same in OSC and OSCMAX from what I remember)
I have read that thread and tried to do everything step by step but I'm simply not getting any e-commerce data through. that was the thread where i said I'm using the urchin code because the new ga.js didn't work properly.

I'm out of ideas... nfi how to make it work.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 07-06-2008, 03:53 AM
MindTwist's Avatar
Active Member
 
Join Date: Jun 2007
Location: Barcelona, Spain
Posts: 346
Thanks: 9
Thanked 27 Times in 26 Posts
Rep Power: 3
MindTwist has a spectacular aura aboutMindTwist has a spectacular aura about
Default Re: Google Analytics e-commerce

Oh, ok. You should specify then that your problem is related to your OSCMAX store being run on SSL, since you say it is working ok when you are not using HTTP.

You paid someone to install it and now you want to see how he did it/what he changed? You should have backed your store FULLY before leting anyone touch it, and after he is finished, compare the BEFORE with the AFTER and see exactly what files he modified, and what changes he did.
__________________
MindTwist of Twisted Reality and Twisted Tienda
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 07-06-2008, 04:03 AM
Member
 
Join Date: Aug 2007
Posts: 68
Thanks: 9
Thanked 1 Time in 1 Post
Rep Power: 2
tcshadow is on a distinguished road
Default Re: Google Analytics e-commerce

I know what he did... It's not working though. He did all the right things and I have also looked through and double checked everything was done right. It simply isn't working and I suspect this is because of BTS. I have not yet heard of anyone getting analytics e-commerce tracking working properly. And if they have, they haven't been open to share how they did it.

basic analytics goal tracking works fine with the old urchin code but that will be phased out within the year. The new ga.js doesn't work properly when it is installed the same way as urchin. No one seems to be able to fix this or have an interest in fixing it though.

I've seen lots of advice based on assumptions but no one is willing to say "this is what I did and I can prove it works". Because it doesn't. At least it's not in the slightest straight forward. I've even installed a vanilla oscmax to try it out and it simply doesn't work.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7  
Old 07-06-2008, 09:46 AM
MindTwist's Avatar
Active Member
 
Join Date: Jun 2007
Location: Barcelona, Spain
Posts: 346
Thanks: 9
Thanked 27 Times in 26 Posts
Rep Power: 3
MindTwist has a spectacular aura aboutMindTwist has a spectacular aura about
Default Re: Google Analytics e-commerce

Can't help then, sorry. I haven't bothered with the new code, and I do not have my store setup with https.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8  
Old 07-06-2008, 09:32 PM
michael_s's Avatar
osCMax Developer

 
Join Date: Jul 2002
Location: Phoenix, AZ
Posts: 10,982
Thanks: 80
Thanked 345 Times in 324 Posts
Rep Power: 10
michael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond repute
Default Re: Google Analytics e-commerce

There are several ways to do this. Here is one simple way:

1. Edit /catalog/includes/configure_bts.php and add a new main template definition.

Under this on line 19:
PHP Code:
define('TEMPLATENAME_MAIN_PAGE''main_page.tpl.php'); 
Add this:
PHP Code:
define('TEMPLATENAME_MAIN_PAGE2''main_page2.tpl.php'); 
Next, after this block of code (lines 43-50) :
PHP Code:
    case 'main':
    
// default or main_page
      
if(is_file(DIR_WS_TEMPLATES TEMPLATENAME_MAIN_PAGE)) {
          
$path = (DIR_WS_TEMPLATES TEMPLATENAME_MAIN_PAGE);
      } else {
          
$path = (DIR_WS_TEMPLATES_FALLBACK TEMPLATENAME_MAIN_PAGE);
      }
    break; 
Add this:
PHP Code:
   case 'main2':
    
// default or main_page
      
if(is_file(DIR_WS_TEMPLATES TEMPLATENAME_MAIN_PAGE2)) {
          
$path = (DIR_WS_TEMPLATES TEMPLATENAME_MAIN_PAGE2);
      } else {
          
$path = (DIR_WS_TEMPLATES_FALLBACK TEMPLATENAME_MAIN_PAGE);
      }
    break; 
2. In /templates/aabox/main_page.tpl.php after this:

PHP Code:
<!-- footer_eof //-->
<?php
}
?>
Add This:
PHP Code:
    <script type="text/javascript">
        var 
gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." "http://www.");
        
document.write(unescape("%3Cscript src='" gaJsHost "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    
</script>
    <script type="text/javascript">
        var pageTracker = _gat._getTracker("UA-xxxxxxx-x");
        pageTracker._initData();
        pageTracker._trackPageview();
    </script> 
3. Copy templates/aabox/main_page.tpl.php to main_page2.tpl.php.

Then edit main_page2.tpl.php. After this:

PHP Code:
<link rel="stylesheet" type="text/css" href="<?php echo DIR_WS_TEMPLATES?>coolmenu.css">
Add this:
PHP Code:
    <script language="javascript" type="text/javascript">
        var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
        document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    </script>
    <script language="javascript" type="text/javascript">
        var pageTracker = _gat._getTracker("UA-xxxxxxx-x");
        pageTracker._initData();
        pageTracker._trackPageview();
        
        <?php 
            
include(DIR_WS_MODULES 'analytics/analytics.php'); 
        
?>
    
    </script>
4. Make sure you follow the mod instructions on how to add your Google ID number to the above code.

5. create a new directory 'analytics' in catalog/includes/modules/.

result: catalog/includes/modules/analytics/.

6. copy the file 'analytics.php' into this directory.

if necessary, change the $transaction_string and/or the $item_string , for example
if you do not use the value customers_state or affiliation tag, replace this with dummy text (company name description), like:

PHP Code:
$transaction_string '"' $order_id '"," ' $analytics_affiliation '",
    "' 
$analytics_total '","' $analytics_tax '","' $analytics_shipping '",
    "' 
$orders['customers_city'] . '","DUMMYTEXT","' $orders['customers_country'] . '"'
7. Edit catalog/checkout_success.php and change this:
PHP Code:
include (bts_select('main'$content_template)); // BTSv1.5 
To this:
PHP Code:
  include (bts_select('main2'$content_template)); // BTSv1.5 
That should do it.
__________________
Michael Sasek
osCMax Developer


  • osCMax Templates - Hundreds of premium quality templates designed for osCMax 2. Loyalty discounts up to 30% off!
    Each purchase supports the osCMax project with much needed funds!

  • xShop for osCMax - Windows Based osCMax administration. Improved workflow, security, speed and convenience.

  • osCMax Hosting - From basic hosting to High Availability, Load Balanced arrays, the most experienced osCMax host. Default multi server configuration for exceptional performance!

  • osCMax Template Tutorial - Learn how to make your own custom templates and how to use the powerful features of the osCMax template system.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to michael_s For This Useful Post:
tcshadow (07-14-2008)
  #9  
Old 07-07-2008, 12:40 AM
Member
 
Join Date: Aug 2007
Posts: 68
Thanks: 9
Thanked 1 Time in 1 Post
Rep Power: 2
tcshadow is on a distinguished road
Default Re: Google Analytics e-commerce

Many thanks Michael,

I'll give this a go tonight on my sandbox and shoot through some transactions to see how it goes.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10  
Old 07-14-2008, 05:24 PM
Member
 
Join Date: Aug 2007
Posts: 68
Thanks: 9
Thanked 1 Time in 1 Post
Rep Power: 2
tcshadow is on a distinguished road
Default Re: Google Analytics e-commerce

I can successfully say that michaels instructions above worked - kind of.

It registered 1 sale(the ecommerce part) last night. I did 2 test transactions. Urchin used to register a conversion even from your filtered ip. It may be that this current code correctly ignores the excluded IPs when it comes to conversions. ie if you do a test order and have a filter set up it won't show...

I'm going to disable my filters now and see how it works...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Advertisement
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Google Analytics (beta) with E-commerce michael_s New osCommerce Contributions 0 06-22-2008 02:13 PM
Google Analytics (beta) with E-commerce michael_s New osCommerce Contributions 1 06-07-2008 01:43 PM
Google Analytics (beta) with E-commerce michael_s New osCommerce Contributions 0 01-15-2008 02:11 AM
Google Analytics (beta) with E-commerce michael_s New osCommerce Contributions 0 01-14-2008 04:42 AM
Google Analytics (beta) with E-commerce michael_s New osCommerce Contributions 0 01-09-2008 04:55 AM


All times are GMT -8. The time now is 01:28 AM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax