This is a discussion on Google Analytics within the osCommerce 2.2 Discussion forums, part of the osCommerce 2.2 Forums category; I want to install Google Analytics, which file do I need to add it to?...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| I want to install Google Analytics, which file do I need to add it to? |
| Sponsored Links | ||
| ||
|
#2
| |||
| |||
| /templates/yourtemplatename/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 |
|
#3
| ||||
| ||||
| Just had to do this, and the search function saved me some time. The contrib I installed was the following: osCommerce: osCommerce Google Analytics module You need to make 3 changes on /templates/yourtemplatename/main_page.tpl.php : Find your stylesheets, which on my template are like this: Code: <link rel="stylesheet" type="text/css" href="<?php echo (bts_select('stylesheet','stylesheet.css')); // BTSv1.5 ?>">
<link rel="stylesheet" type="text/css" href="<?php echo (bts_select('stylesheet','print.css')); // BTSv1.5 ?>" media="print">
Code: <?php
// osCoders.biz - Analystics - start
/*
Conditional code added thank to rrodkey and bfcase
IMPORTANT -- IMPORTANT - IMPORTANT
You'll need to update the "xxxx-x" in the samples (twice) above with your own Google Analytics account and profile number.
To find this number you can access your personalized tracking code in its entirety by clicking Check Status in the
Analytics Settings page of your Analytics account.
*/
if ($request_type == 'SSL') {
?>
<script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct="UA-XXXXXX-X";
urchinTracker();
</script>
<?php
} else {
?>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct="UA-XXXXXX-X";
urchinTracker();
</script>
<?
}
// osCoders.biz - Analistics - end
?>
Code: <body> Code: </head> // osCoders.biz - Analistics - start // The onLoad="java script:__utmSetTrans()" from the <body ... > tag // was added for the Google Analytics contribution // osCoders.biz - Analistics - end <body onLoad="javascript:__utmSetTrans()"> And at the end, find the /body tag: Code: </body> Code: <?php
// osCoders.biz - Analystics - start
include(DIR_WS_MODULES . 'analytics/analytics.php');
// osCoders.biz - Analistics - end
?>
Hopefully this is all that needs to be done, my Google Analytics account has checked my installation and said it is ok, and that it is gathering information and I will have my first reports no later than 24h from now. |
| The Following User Says Thank You to MindTwist For This Useful Post: | ||
eyeofhorus (11-24-2007) | ||
|
#4
| |||
| |||
| Well I am followed your directions I hope it works in 24 hrs too I'll post if it worked for me |
|
#5
| |||
| |||
| i get a string at the bottom of my screen after installing this... any idea what that is? "pageTracker._addTrans( "460"," ","2700.00","0.00","0.00","Houston","Texas","U SA" ); pageTracker._addItem( "460","1167","Sharp Dial Microwave R-21LCF","Microwave Ovens","249.00","12"); pageTracker._trackTrans(); " |
|
#6
| |||
| |||
| I put mine in this file and it won't pick up my checkout_success.php any ideas why? Oh I'm using the new code btw not urchin Last edited by tcshadow; 06-23-2008 at 02:12 PM. |
|
#7
| ||||
| ||||
| So, what is "mine", and what it won't pick up? |
|
#8
| |||
| |||
| PHP Code: ie it works just fine and dandy on http pages and they show up in my analytics but none of the pages in https(ie past /checkout_shipping.php) show up.. this means my goals aren't being tracked |
|
#9
| |||
| |||
| I just did some more looking into it and it seems that it tracks all the way to /checkout_confirmation.php and then gets lost between there and my /checkout_success.php any idea why it's not recording /checkout_success.php? |
|
#10
| ||||
| ||||
| No clue, sorry. I still use the old google analytics code (urchin) and I do not use SSL on my web page (just for CC transactions, and that is handled by me) |
| Sponsored Links | ||
| ||
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| osCommerce Google Analytics module | michael_s | New osCommerce Contributions | 0 | 06-21-2007 03:01 PM |
| osCommerce Google Analytics module | michael_s | New osCommerce Contributions | 0 | 02-14-2007 04:21 AM |
| osCommerce Google Analytics module | michael_s | New osCommerce Contributions | 0 | 02-13-2007 02:50 PM |
| Google-Analytics | dasmurphy | osCMax v2 Customization/Mods | 3 | 08-24-2006 10:02 AM |
| Reviews and google analytics | dasmurphy | osCMax v2 Installation issues | 0 | 08-15-2006 06:28 PM |