Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Google Analytics module


Guest

Recommended Posts

The module is functioning correctly I checked it in the Google analytics pages... its receiving data.. no problem there.. but when the reach checkout_success.php they get some code appearing at the top of the page like this above my header image:

 

// osCoders.biz - Analistics - start // The onLoad="java script:__utmSetTrans()" from the tag // was added for the Google Analytics contribution // osCoders.biz - Analistics - end

 

not sure why this is showing up? could I have installed the code in the wrong place??

 

cheers,

 

Please post the php code of your checkout_success.php page

Link to comment
Share on other sites

  • Replies 389
  • Created
  • Last Reply

Top Posters In This Topic

Will someone please verify this the correct Google Analytics install for STS?

I have STS and have just installed Google Analytics as outlined below.

Thanks

 

1. Edit catalog\includes\sts_display_output.php

 

Insert this :

if ($request_type == 'SSL') {
 $template['headcontent'] .= '<script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript">' . "\n";
 $template['headcontent'] .= '</script>' . "\n";
 $template['headcontent'] .= '<script type="text/javascript">' . "\n";
 $template['headcontent'] .= '_uacct="UA-xxxxxx-x";' . "\n";
 $template['headcontent'] .= 'urchinTracker();' . "\n";
 $template['headcontent'] .= '</script>' . "\n";
} else {
 $template['headcontent'] .= '<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">' . "\n";
 $template['headcontent'] .= '</script>' . "\n";
 $template['headcontent'] .= '<script type="text/javascript">' . "\n";
 $template['headcontent'] .= '_uacct="UA-xxxxxx-x";' . "\n";
 $template['headcontent'] .= 'urchinTracker();' . "\n";
 $template['headcontent'] .= '</script>' . "\n";
}

After:

 // Load up the <head> content that we need to link up everything correctly.  Append to anything that may have been set in sts_user_code.php
 $template['headcontent'] .= '<meta http-equiv="Content-Type" content="text/html; charset=' . CHARSET . '">' . "\n";
 $template['headcontent'] .= $sts_block['headertags'];
 $template['headcontent'] .= '<base href="' . (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG . '">' . "\n";

 

2. Edit catalog/checkout_success.php -

a. INSERT into the <body tag the following
onLoad="java script:__utmSetTrans()"

So the line looks like:
 <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" onLoad="java script:__utmSetTrans()">

 

b.Right ABOVE the </body> tag (the bottom of the page) ADD:

<?php 
// osCoders.biz - Analystics - start 
	include(DIR_WS_MODULES . 'analytics/analytics.php'); 
// osCoders.biz - Analistics - end
?>

 

Link to comment
Share on other sites

Please post the php code of your checkout_success.php page

<?php
/*
 $Id: checkout_success.php,v 1.49 2003/06/09 23:03:53 hpdl Exp $

 Include Google Analystics module for osCommerce
 Added by  Clement Nicolaescu (http://www.osCoders.biz) 

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

// if the customer is not logged on, redirect them to the shopping cart page
 if (!tep_session_is_registered('customer_id')) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
 }

 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'update')) {
$notify_string = 'action=notify&';
$notify = $HTTP_POST_VARS['notify'];
if (!is_array($notify)) $notify = array($notify);
for ($i=0, $n=sizeof($notify); $i<$n; $i++) {
  $notify_string .= 'notify[]=' . $notify[$i] . '&';
}
if (strlen($notify_string) > 0) $notify_string = substr($notify_string, 0, -1);

tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string));
 }

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SUCCESS);

 $breadcrumb->add(NAvb script:__utmSetTrans()"  from the <body ... > tag
//	 was added for the Google Analytics contribution
// osCoders.biz - Analistics - end

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" onLoad="java script:__utmSetTrans()">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><?php echo tep_draw_form('order', tep_href_link(FILENAME_CHECKOUT_SUCCESS, 'action=update', 'SSL')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
	<td><table border="0" width="100%" cellspacing="4" cellpadding="2">
	  <tr>
		<td valign="top"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_man_on_board.gif', HEADING_TITLE); ?></td>
		<td valign="top" class="main"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?><div align="center" class="pageHeading"><?php echo HEADING_TITLE; ?></div><br><?php echo TEXT_SUCCESS; ?><br><br>
<?php
 if ($global['global_product_notifications'] != '1') {
echo TEXT_NOTIFY_PRODUCTS . '<br><p class="productsNotifications">';

$products_displayed = array();
for ($i=0, $n=sizeof($products_array); $i<$n; $i++) {
  if (!in_array($products_array[$i]['id'], $products_displayed)) {
	echo tep_draw_checkbox_field('notify[]', $products_array[$i]['id']) . ' ' . $products_array[$i]['text'] . '<br>';
	$products_displayed[] = $products_array[$i]['id'];
  }
}

echo '</p>';
 } else {
echo TEXT_SEE_ORDERS . '<br><br>' . TEXT_CONTACT_STORE_OWNER;
 }
?>
		<h3><?php echo TEXT_THANKS_FOR_SHOPPING; ?></h3></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td align="right" class="main"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
		  <tr>
			<td width="50%" align="right"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
			<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
		  </tr>
		</table></td>
		<td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
		<td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
		<td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
		  <tr>
			<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
			<td width="50%"><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	  <tr>
		<td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_DELIVERY; ?></td>
		<td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>
		<td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
		<td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_FINISHED; ?></td>
	  </tr>
	</table></td>
  </tr>
<?php if (DOWNLOAD_ENABLED == 'true') include(DIR_WS_MODULES . 'downloads.php'); ?>
</table></form></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
<?php 
// osCoders.biz - Analystics - start 
include(DIR_WS_MODULES . 'analytics/analytics.php'); 
// osCoders.biz - Analistics - end
?>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Graham

DJS | MEDIA | MUSIC | CULTURE

Link to comment
Share on other sites

  • 2 weeks later...

Thanks in advanced for your help!

 

I have STS and have installed Google Analytics as outlined below.

I added $template['headcontent'] .= '_userv=2;' . "\n"; as per google since I am using both conversion tracking and analytics. This has been running for 11 days now. It tracks visits, page views, etc, almost everything. My Funnel Navigation shows the complete steps through the checkout process to checkout_sucess.php. The problem is no sales and conversion information is not being passed to google.

 

What is wrong and how do I correct this?

 

1. Edit catalog\includes\sts_display_output.php

 

Insert this :

if ($request_type == 'SSL') {
 $template['headcontent'] .= '<script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript">' . "\n";
 $template['headcontent'] .= '</script>' . "\n";
 $template['headcontent'] .= '<script type="text/javascript">' . "\n";
 $template['headcontent'] .= '_uacct="UA-xxxxxx-x";' . "\n";
 $template['headcontent'] .= '_userv=2;' . "\n";
 $template['headcontent'] .= 'urchinTracker();' . "\n";
 $template['headcontent'] .= '</script>' . "\n";
} else {
 $template['headcontent'] .= '<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">' . "\n";
 $template['headcontent'] .= '</script>' . "\n";
 $template['headcontent'] .= '<script type="text/javascript">' . "\n";
 $template['headcontent'] .= '_uacct="UA-xxxxxx-x";' . "\n";
 $template['headcontent'] .= '_userv=2;' . "\n";
 $template['headcontent'] .= 'urchinTracker();' . "\n";
 $template['headcontent'] .= '</script>' . "\n";
}

After:

// Load up the <head> content that we need to link up everything correctly.  Append to anything that may have been set in sts_user_code.php
 $template['headcontent'] .= '<meta http-equiv="Content-Type" content="text/html; charset=' . CHARSET . '">' . "\n";
 $template['headcontent'] .= $sts_block['headertags'];
 $template['headcontent'] .= '<base href="' . (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG . '">' . "\n";

 

2. Edit catalog/checkout_success.php -

 

a. INSERT into the <body tag the following

onLoad="java script:__utmSetTrans()"

So the line looks like:

 <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" onLoad="java script:__utmSetTrans()">

 

b.Right ABOVE the </body> tag (the bottom of the page) ADD:

  <?php
	// osCoders.biz - Analystics - start
		include(DIR_WS_MODULES . 'analytics/analytics.php');
	// osCoders.biz - Analistics - end
	?>

Link to comment
Share on other sites

The module is functioning correctly I checked it in the Google analytics pages... its receiving data.. no problem there.. but when the reach checkout_success.php they get some code appearing at the top of the page like this above my header image:

 

// osCoders.biz - Analistics - start // The onLoad="java script:__utmSetTrans()" from the tag // was added for the Google Analytics contribution // osCoders.biz - Analistics - end

 

not sure why this is showing up? could I have installed the code in the wrong place??

 

This part is where it's messed up:

 

 $breadcrumb->add(NAvb script:__utmSetTrans()"  from the <body ... > tag
//	 was added for the Google Analytics contribution
// osCoders.biz - Analistics - end

 

mine looks like:

  $breadcrumb->add(NAVBAR_TITLE_1);
 $breadcrumb->add(NAVBAR_TITLE_2);

$global_query = tep_db_query("select global_product_notifications from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id . "'");
 $global = tep_db_fetch_array($global_query);

 

and there is more code missing from yours: it think you accidentally deleted a bunch of lines :-)

Edited by pixclinic
Link to comment
Share on other sites

Is there any support for STS & this module?

 

Thanks in advanced for your help!

 

I have STS and have installed Google Analytics as outlined below.

I added $template['headcontent'] .= '_userv=2;' . "\n"; as per google since I am using both conversion tracking and analytics. This has been running for 11 days now. It tracks visits, page views, etc, almost everything. My Funnel Navigation shows the complete steps through the checkout process to checkout_sucess.php. The problem is no sales and conversion information is not being passed to google.

 

What is wrong and how do I correct this?

 

1. Edit catalog\includes\sts_display_output.php

 

Insert this :

if ($request_type == 'SSL') {
 $template['headcontent'] .= '<script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript">' . "\n";
 $template['headcontent'] .= '</script>' . "\n";
 $template['headcontent'] .= '<script type="text/javascript">' . "\n";
 $template['headcontent'] .= '_uacct="UA-xxxxxx-x";' . "\n";
 $template['headcontent'] .= '_userv=2;' . "\n";
 $template['headcontent'] .= 'urchinTracker();' . "\n";
 $template['headcontent'] .= '</script>' . "\n";
} else {
 $template['headcontent'] .= '<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">' . "\n";
 $template['headcontent'] .= '</script>' . "\n";
 $template['headcontent'] .= '<script type="text/javascript">' . "\n";
 $template['headcontent'] .= '_uacct="UA-xxxxxx-x";' . "\n";
 $template['headcontent'] .= '_userv=2;' . "\n";
 $template['headcontent'] .= 'urchinTracker();' . "\n";
 $template['headcontent'] .= '</script>' . "\n";
}

After:

// Load up the <head> content that we need to link up everything correctly.  Append to anything that may have been set in sts_user_code.php
 $template['headcontent'] .= '<meta http-equiv="Content-Type" content="text/html; charset=' . CHARSET . '">' . "\n";
 $template['headcontent'] .= $sts_block['headertags'];
 $template['headcontent'] .= '<base href="' . (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG . '">' . "\n";

 

2. Edit catalog/checkout_success.php -

 

a. INSERT into the <body tag the following

onLoad="java script:__utmSetTrans()"

So the line looks like:

 <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" onLoad="java script:__utmSetTrans()">

 

b.Right ABOVE the </body> tag (the bottom of the page) ADD:

  <?php
	// osCoders.biz - Analystics - start
		include(DIR_WS_MODULES . 'analytics/analytics.php');
	// osCoders.biz - Analistics - end
	?>

Link to comment
Share on other sites

I got one idea , but need help to make it work

 

I think it would be a good idea to move the value of UA-XXXXXX-X to the admin

 

I got several shop based on the same code , and what is different is what is in the configure.php and in the MY SHOP value in admin

 

but since it s not php how to change

 

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct="UA-XXXXXX-X";
urchinTracker();
</script>

 

to something using php like that ,any one could tell me the right syntax to make it work: <php echo UA_CODE_ENTERED_IN_ADMIN ; ?>

 

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct="<php echo UA_CODE_ENTERED_IN_ADMIN; ?>";
urchinTracker();
</script>

MS2

Link to comment
Share on other sites

I got one idea , but need help to make it work

 

I think it would be a good idea to move the value of UA-XXXXXX-X to the admin

 

I got several shop based on the same code , and what is different is what is in the configure.php and in the MY SHOP value in admin

 

but since it s not php how to change

 

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct="UA-XXXXXX-X";
urchinTracker();
</script>

 

to something using php like that ,any one could tell me the right syntax to make it work: <php echo UA_CODE_ENTERED_IN_ADMIN ; ?>

 

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct="<php echo UA_CODE_ENTERED_IN_ADMIN; ?>";
urchinTracker();
</script>

 

if this can help you:

 

run the following sql query in myphpadmin:

 

INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` ) 
VALUES (
'', 'Google Analytics Account ID', 'GOOGLE_UA_ID', '', 'Enter Your Google Analytics ID Account (UA-XXXXXX-X)', '1', '5' , '2006-07-21 08:54:14', '2006-07-21 08:54:14', NULL , NULL 
);

 

 

and replace

 

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct="UA-XXXXXX-X";
urchinTracker();
</script>

 

by

 

 <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
<?php echo '_uacct="' . GOOGLE_UA_ID .'"'?>;
urchinTracker();
</script>

 

That's it!

Edited by pixclinic
Link to comment
Share on other sites

Ahoi,

 

i just added a hardcoded-section in the admin to access the Google-Analytics from there:

 

'<a href="https://www.google.com/analytics/home/report?" target="_blank"class="menuBoxContentLink">' . "GoOgLe-Anal" . '</a><br>' .

 

Put this somewhere in the catalog/admin/includes/boxes/report.php (or somewhere else you like it to appear) and - thats it. B)

 

Maybe someone can put this option (maybe with showing inner the admin gui) into osCommerce conform code.

 

 

Regards

 

Franz

Link to comment
Share on other sites

BECAUSE i work in local before uplaoding to he host i needed to desactivate the google stat locally so i create the variable AZERCA_GOOGLE_ANALYTICS that i define in my configure.php , so with the code of frenchbe , here is what i fnial i got in my checkout_success.php , can someone tell me if every thing seems to be ok ? and also if it s the code taht i can also paste in all other content files ?

 

<?php if (AZERCA_GOOGLE_ANALYTICS=='true') {?> 
<?php /***** AZER 06nov06 google analytic BOF ***************************************/
// osCoders.biz - Analystics - start
if ($request_type == 'SSL') {
?>
<script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
<?php echo '_uacct="' . GOOGLE_UA_ID .'"'?>;
urchinTracker();
</script>
<?php
} else {
?>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
<?php echo '_uacct="' . GOOGLE_UA_ID .'"'?>;
urchinTracker();
</script>
<?
}
// osCoders.biz - Analistics - end
/***** AZER 06nov06 google analytic EOF ======================================== */ 
?>
<?php }  /* fin de test activation de contrib */ ?>

</head>

<?php /***** AZER 06nov06 google analytic BOF ********************
---------------- Debut de code original ----------------------------------------------------------
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
*/ ?>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" onLoad="java script:__utmSetTrans()">
<?php /***** AZER 06nov06 google analytic EOF ====================== */?>

<!-- header //-->

MS2

Link to comment
Share on other sites

?y code was wrong is it again fixed :

 

<?php /***** AZER 06nov06 google analytic BOF ***************************************/
if (AZERCA_GOOGLE_ANALYTICS=='true') {
// osCoders.biz - Analystics - start
if ($request_type == 'SSL') {
?>
<script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
<?php echo '_uacct="' . GOOGLE_UA_ID .'"'?>;
urchinTracker();
</script>
<?php
} else {
?>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
<?php echo '_uacct="' . GOOGLE_UA_ID .'"'?>;
urchinTracker();
</script>
<?
}
// osCoders.biz - Analistics - end

?>
<?php }  /* fin de test activation de contrib */ 
/***** AZER 06nov06 google analytic EOF ======================================== */ 
?>

MS2

Link to comment
Share on other sites

Ok, how long do ecommerce statistics usually take to show up in analytics? I fear I have done something wrong.

 

I've linked the analytics code in my header to the https://js.etc google tracker, and I have the correct code in place. Then, on google analytics itself I have defined my website as https://mysite.com

 

And yet nothing shows up in the ecommerce section. If I set it to https as I have above for all of my pages, will it record the transactions as well as regular pages no problem? What have I done wrong?

Link to comment
Share on other sites

I have my Google Analytics code installed correctly (as far as I know) and all is well except for tracking the e-commerce transactions (i.e. all the reports under the E-Commerce Analysis tab in the Google interface). I have my code in the following pages:

index.php

product_info.php

shopping_cart.php

checkout_shipping.php

checkout_payment.php

checkout_success.php

 

Here's an example of my code from the index.php page (Google # is blanked out):

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="LTR" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Laurel's Stitchery</title>
<base href="http://laurelsstitchery.com/catalog/">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct="UA-xxxxx-x";
urchinTracker();
</script>
</head>

 

Could someone let me know what the problem might be? I'm sure I've just missed a step somewhere, but my eyes can't find it. :)

Laurel

Link to comment
Share on other sites

be sure you have the following at teh bottom of your checkout_success.php file:

 

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
<?php 
// osCoders.biz - Analystics - start 
	include(DIR_WS_MODULES . 'analytics/analytics.php'); 
// osCoders.biz - Analistics - end
?>
</body>

 

and that e-commerce is checked in your Google settings!

Edited by pixclinic
Link to comment
Share on other sites

I have that code in the correct place and I've checked e-commerce in the Analytics settings, but it's still not working. Anything else it might be? :)

 

be sure you have the following at teh bottom of your checkout_success.php file:

 

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
<?php 
// osCoders.biz - Analystics - start 
	include(DIR_WS_MODULES . 'analytics/analytics.php'); 
// osCoders.biz - Analistics - end
?>
</body>

 

and that e-commerce is checked in your Google settings!

Laurel

Link to comment
Share on other sites

Actually, in my checkout_success.php file, here's what I have in the head portion:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
			<?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-80537-1";
			   urchinTracker();
			 </script>
			<?php
			} else {
			?>
			 <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
			 </script>
			   <script type="text/javascript">
				_uacct="UA-80537-1";
				urchinTracker();
			 </script>
			<?
			}
			// osCoders.biz - Analistics - end
			?>
</head>

Is this what I should have in the head portion? :)

 

I have that code in the correct place and I've checked e-commerce in the Analytics settings, but it's still not working. Anything else it might be? :)

Laurel

Link to comment
Share on other sites

Is this what I should have in the head portion? :)

 

Read my answer again about what shoud be AT THE BOTTOM of your checkout_sucess.php file :blink:

Edited by pixclinic
Link to comment
Share on other sites

I had two replies right in a row - the first one confirmed that I do have this code at the bottom. Sorry for the confusion. My second question was about the head portion with the SSL version and the other version both being there. :)

 

Read my answer again about what shoud be AT THE BOTTOM of your checkout_sucess.php file :blink:

Laurel

Link to comment
Share on other sites

Read my answer again about what shoud be AT THE BOTTOM of your checkout_sucess.php file :blink:

 

:thumbsup: your top portion seems to be fine

Edited by pixclinic
Link to comment
Share on other sites

I went back to the Google Help pages and found this page. It has basically the same information for the top of my file, but then it says this:

Next, somewhere in the receipt below the tracking code, the following lines need to be written by your engine. Everything in brackets should be replaced by actual values, as described in the Parameter Reference, below.

 

<form style="display:none;" name="utmform">

<textarea id="utmtrans">UTM:T|[order-id]|[affiliation]|

[total]|[tax]| [shipping]|[city]|[state]|[country] UTM:I|[order-id]|[sku/code]|[productname]|[category]|[price]|

[quantity] </textarea>

</form>

 

Finally, the utmSetTrans function must be called after the form is submitted in order to record the transaction. This can be most easily accomplished through a body onLoad event within the opening <body> tag:

 

<body onLoad="java script:__utmSetTrans()">

 

If you don't have the ability to edit the body tag, you can call the utmSetTrans function within a separate script tag as long as you ensure that the function is called after the form:

 

<script type="text/javascript">

__utmSetTrans();

< /script>

 

How is this information incorporated into the code I already have in my page? Should I post my whole checkout_success.php? Let me know. Sorry to be such a pest! :)

 

Any other ideas on why the transaction information isn't being passed to Google? This is driving me bonkers! :blink:

:D

Laurel

Link to comment
Share on other sites

I went back to the Google Help pages and found this page. It has basically the same information for the top of my file, but then it says this:

How is this information incorporated into the code I already have in my page? Should I post my whole checkout_success.php? Let me know. Sorry to be such a pest! :)

 

This part that you read on Google site is what the bottom part I was talking about is doing

 

and of course, you need the

 

 onLoad="java script:__utmSetTrans()">

 

in your body tag

 

all the code that you menionned is built by the

 

include(DIR_WS_MODULES . 'analytics/analytics.php');

 

line

Link to comment
Share on other sites

this is what I can read in the Google Analytics OScomm installation file. there is no reason you didn't see the same ;)

 

2. Edit checkout_success.php -

 

INSERT into the <body tag the following code:

 

onLoad="java script:__utmSetTrans()"

 

 

Finally the line should look like this:

 

 

	<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" onLoad="java script:__utmSetTrans()">

 

 

3. Edit checkout_success.php -

 

ADD right ABOVE the </body> tag (the bottom of the page)

 

<?php 
// osCoders.biz - Analystics - start 
	include(DIR_WS_MODULES . 'analytics/analytics.php'); 
// osCoders.biz - Analistics - end
?>

 

 

4. Upload the analytics.php into a new includes/modules/analytics directory like:

 

- includes/modules/analytics/analytics.php

Edited by pixclinic
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...