PumpinIron Posted July 25, 2007 Share Posted July 25, 2007 Okay so I'm going to try and explain things the best I can so that everyone can understand my problem. My website is http://www.baselinenutritionals.com It's an e-Commerce website and once someone gets all the way through the checkout process and the system process' their credit card what happens is the site uses Authorize.net's AIM method. Anyhow what this looks like when you place an order is you start out on a baselinenutritonals.com page that says "Process your order" and you click that button to process the order. The system then transfers you to a authorize.net page with this URL " https://secure.authorize.net/gateway/transact.dll" Ok so apparently if authorize.net generates a 1 the card was approved but if it gets a 0 it was not approved. If it was approved then that same Authroize.net URL ( https://secure.authorize.net/gateway/transact.dll) says that your order was completed and bla bla bla. Now since I want to track how many people are placing orders in Google Analytics I have to add a bit of javascript that Google gives you and it has to be included in the final checkout completed page which is http://www.baselinenutritionals.com/transaction.php The contents and code of that page are below. Towards the very end of the code you will see the Google code. The way I've got it setup it should work just fine but I've had it up for several days now and Google still shows 0 orders processed which is of course wong because we're doing a lot in sales each day. I'm hoping someone can look over my code for me and tell me if I have done something wrong with the Google code part of the page or what? <? /*************************************************************************************************************** changed the way transactions are stored saving checkout info along with the individual items bought was moved into this script ***************************************************************************************************************/ include("$DOCUMENT_ROOT/common/sql.php"); include("$DOCUMENT_ROOT/common/functions.php"); include("$DOCUMENT_ROOT/lib/clsProcess.php"); // RUN A TEST TRANSACTION if( $SERVER_NAME == 'www.baselinenutritionals.com' ) $secure = 's'; // we store each transaction that comes disregarding its status include('cart/save_checkout.php'); if ( $HTTP_POST_VARS['x_response_code'] == 1 ) { // update the Current Stock info for( $i = 0; $i < count( $products['ID'] ); $i++ ) if( $products['quantity'][$i] ) update_stock( $products['ID'][$i], $products['quantity'][$i]); $redir = "http$secure://$SERVER_NAME/receipt.php"; $label = "View Receipt"; $label2 = "Return"; $msg = 'Thank you for your order!'; // notify the merchant of the new order send_sales_notice(); include('cart/save_customer_account.php'); // find out if the account information has been sent to the customer if ( $ID && $HTTP_POST_VARS['Billing_Email'] ) { $sql = "SELECT AccountInfoSent, UserName, Password FROM customers WHERE ID = " . $ID; $res = mysql_query( $sql ); list( $AccountInfoSent, $customers_UserName, $customers_Password ) = mysql_fetch_row( $res ); // unset these so the account info doesn't get sent again and again if( $AccountInfoSent ) { $customers_UserName = ''; $customers_Password = ''; } } // send info on the order and / or on his account to the customer if ( $HTTP_POST_VARS['Billing_Email'] ) send_transaction_success_notice( $HTTP_POST_VARS['Billing_Email'], $customers_UserName, $customers_Password ); } else { $redir = "http$secure://$SERVER_NAME/index.php?display=products&view=$view"; $label = "Return To Correct"; $label2 = "Leave Declined"; $msg = 'Your order has been declined.'; } // endif; ?> <html> <body> <form action="<? echo $redir; ?>" method="POST"> <input type="hidden" name="step" value="4"> <input type="hidden" name="StepsCompleted" value="5"> <table width="400" cellspacing="3" cellpadding="0" border="0" align="center"> <tr> <td colspan="5"> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td background="img/line1.gif"><img src="../images/spacer.gif" alt="" width="1" height="1" border="0"></td> </tr> </table> </td> </tr> <tr> <td colspan="5"><img src="../images/spacer.gif" alt="" width="1" height="50" border="0"></td> </tr> <tr> <td colspan="5" align="center" style="font: bold 16px Arial, sans-serif;"><b><? echo $msg; ?></b></td> </tr> <tr> <td colspan="5" align="center" style="font: 13px Arial, sans-serif;"><? echo $HTTP_POST_VARS['x_response_reason_text']; ?></td> </tr> <tr> <td colspan="5" align="center" style="font: 13px Arial, sans-serif;"><!-- Note: No actual processing has been done.--></td> </tr> <tr> <td colspan="5"><img src="../images/spacer.gif" alt="" width="1" height="100" border="0"></td> </tr> <tr> <td colspan="2"><input type="submit" value="<? echo $label; ?>" style="width: 120px;"></td> <td> </td> <td colspan="2" align="right"><input type="button" value="<? echo $label2; ?>" onClick="top.location.href = 'http://<? echo $SERVER_NAME; ?>/index.php';" style="width: 120px;"></td> </tr> </table> <? if ( $HTTP_POST_VARS['x_response_code'] == 1 ) : // we only send checkout id to the receipt page ?> <input type="hidden" name="checkout_ID" value="<? echo (date('y') + 10 ) . date('m') .date('d') . $checkout_ID; ?>"> <? endif; // list out all POSTed data except these $exclude = Array('step', 'StepsCompleted', 'checkout_ID'); foreach( $HTTP_POST_VARS as $key => $val ) { if ( ! in_array( $key, $exclude ) && substr($key, 0, 2) != 'x_' ) : ?> <input type="hidden" name="<? echo $key; ?>" value="<? echo htmlspecialchars( stripslashes( $val ) ); ?>"> <? endif; } ?> </form> <? if ( $HTTP_POST_VARS['x_response_code'] == 1 && ! $HTTP_REFERER ) : ?> <img src="https://www.clixgalore.com/AdvTransaction.aspx?AdId=3233&SV=<? echo $HTTP_POST_VARS['x_amount']; ?>&OID=<? echo $HTTP_POST_VARS['checkout_ID']; ?>" width="1" height="1"> <? endif; ?> <? if ( $HTTP_POST_VARS['x_response_code'] == 1) : ?> <!-- GOOGLE ANALYTICS TRACKER CODE --> <script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-1204354-2"; _udn="none"; _ulink=1; urchinTracker(); </script> <!-- GOOGLE ANALYTICS TRACKER CODE --> <!-- Google Code for purchase Conversion Page --> <script language="JavaScript" type="text/javascript"> <!-- var google_conversion_id = 1071450369; var google_conversion_language = "en_US"; var google_conversion_format = "2"; var google_conversion_color = "FFFFFF"; if (1) { var google_conversion_value = 1; } var google_conversion_label = "purchase"; //--> </script> <script language="JavaScript" src="http://www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <img height=1 width=1 border=0 src="http://www.googleadservices.com/pagead/conversion/1071450369/imp.gif?value=1&label=purchase&script=0"> </noscript> <? endif; ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
PumpinIron Posted July 26, 2007 Author Share Posted July 26, 2007 Anyone? Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 26, 2007 Share Posted July 26, 2007 read this agin ok. http://www.google.com/support/analytics/bin/answer.py?answer=26915&hl=en Quote Link to comment Share on other sites More sharing options...
PumpinIron Posted July 26, 2007 Author Share Posted July 26, 2007 I read that numerous times even before you posted that link but I've covered everything in that documentation and still nothing. Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 26, 2007 Share Posted July 26, 2007 this is wrong $HTTP_POST_VARS should be $_POST['what_ever'] i thnik the varables are not being posted then unless php3 being use dont think so. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.