One page checkout activity/error report - Ecommerce Forums
Page 1 of 9 123456789 LastLast
Results 1 to 15 of 122

Thread: One page checkout activity/error report

  1. #1

    One page checkout activity/error report

    In response to some phone calls recently from customer about checkout issues and there inability to convey what messages they were seeing I decided to see if I could come up with a method whereby I could somehow log and/or gather this info in as near real time as possible with relavent info to help me figure out what may be happening. So here is a start to a project that will ( I hope ) help to gather some data and e-mail that data to an e-mail address with a timestamp.

    Here is what it does currently.

    When a person is on the one-page-checkout.asp page and submits the order if for some reason the order is not processed and the page responds with the famous yellow errors text the script will gather all the error text along with the cart id and send it to a custom ASP page which in turn sends the data VSMTP process ( Volusion's built in e-mail processing) which e-mails anyone you wish to. I have it e-mailing me so I can near instantly see if someone is having an checkout issue.

    The e-mail contains the date / time the issue happened, The cart id # as a link to the actual cart in the admin area so you can click on it in the e-mail and be taken directly to it in case you want to bring that cart to the store front or perhaps bring it to the phone order page. The e-mail contains any and all error text messages.

    I will most likely also put in the e-mail the cart contents at some point but for now this is a start. I am wondering what other info would be useful. Perhaps customer ID, name, address, phone#, e-mail, etc...

    Here is what a sample e-mail looks like except the the cart id shown is a link.

    Code:
    9/27/2014 12:56:15 PM
    5DDA9298CFCA4014923FDFD0766900B9
    
    Please fill in the Billing Address field First Name.
    Please fill in the Billing Address field Last Name.

  2. #2
    The code to do this is as follows...

    Be sure to get your VSMTP key for you site and insert it in the VSMTPKey variable. Every sites key is unique.
    Set the from and to e-mail address accordingly. The from really doesn't matter what you put there.
    Set any time offset from your sites physical location. Be sure this is a number not a string. For instance my Volusion server has a 3 hour difference from my location. This is for the correct time stamp shown in the e-mail
    Change the subject variable if you wish it to say something else in the e-mail.

    Save this as onepageactivity.asp into the root directory via FTP "/v/onepageactivity.asp"


    Code:
    <%
    Option Explicit
    Dim subject : subject = "One Page Checkout Activity Report"
    Dim email_to : email_to = "emailto@websiteaddress.com"
    Dim email_from : email_from = "emailfrom@websiteaddress.com"
    Dim time_offset : time_offset = 3
    Dim VSMTPKey : VSMTPKey = "1123456F-BBBB-4444-8888-444444444444"
    
    Dim CartID5 : CartID5 = Request.Cookies("CartID5")
    Dim Errortext_formatted
    Dim i
    
    if Request.Form("Errortext").Count > 0 then	
    
    		For i = 1 To Request.Form("Errortext").Count 
    			Errortext_formatted = Errortext_formatted & Server.URLEncode(Request.Form("Errortext")(i)) & "<BR>" 
    		Next 
    
    		Dim HTTPRequest1
    		Set HTTPRequest1 = CreateObject("WinHTTP.WinHTTPRequest.5.1")
    		HTTPRequest1.Open "POST", "http://" & Request.ServerVariables("LOCAL_ADDR") & "/vsmtp.asp", False
    		HTTPRequest1.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    		HTTPRequest1.SetRequestHeader "Host", Request.ServerVariables("SERVER_NAME")
    		HTTPRequest1.Send _
    			"VsmtpKey=" & VSMTPKey  &_
    			"&Subject=" & Server.URLEncode(subject) &_
    			"&FromEmailAddress=" & email_from &_
    			"&ToEmailAddress=" & email_to &_
    			"&Body_HTML=" & Server.URLEncode(dateadd("h", time_offset, now())) & "<br>"  &  Server.URLEncode("<a href='https://") & Request.ServerVariables("SERVER_NAME") & Server.URLEncode("/admin/admindetails_generic.asp?table=CartIDLog&ID=") &  CartID5 & "'>"  & CartID5  &"</a><br><br>"  & Errortext_formatted
    		response.write(HTTPRequest1.ResponseText)
    End If
    
    %>
    Then place the following in one of your one-page-checkout articles. Like 115 or 116


    Code:
    <script type="text/javascript">
    jQuery(function () {
    	if ( jQuery('.v65-error-list-text').length ) {
    		var data_string = '';
    		jQuery('.v65-error-list-text ul').find('li').each(function(){
    			data_string = data_string + 'Errortext=' + encodeURIComponent(jQuery.trim(jQuery(this).text())) + '&';
    		});
    		jQuery.ajax({
    			url: '/v/onepageactivity.asp',
    			type: 'POST',
                            cache: false,
    			data: data_string,
    			success: function (data) {
    			}
    		});
    	}
    });
    </script>
    To find your unique key look here... https://support.volusion.com/article/vsmtp-key

    That's it, as soon as a customer get's a yellow error text it will send you an e-mail with the info mentioned above. Normal time for e-mail to be sent is about 30 seconds.


    Let me know if you have any questions, comments or suggestions.

    Enjoy
    Last edited by Marc_NY; 09-27-2014 at 11:11 AM.

  3. #3
    Great idea, Marc.

    Since I'm very unhappy today looking at stats of the people who have thus far made it out of my OPC alive, this is very interesting to me. Here come the stupid questions.

    a) So this automatically sets up the custom .asp page?

    b) Can that custom .asp page be seen/crawled?

    c) If my server is on the same time frame, what would I put in place of the 3? A zero? Or would I put that line in there at all?

  4. #4
    I wouldn't worry about the crawling thing but if it makes you happy add it to your robots.txt file.

    Yes "0" is correct

  5. #5
    Quote Originally Posted by Marc_NY View Post
    I wouldn't worry about the crawling thing but if it makes you happy add it to your robots.txt file.
    haha! You know I worry about everything. What exactly would the page say?

  6. #6
    What? The page doesn't say anything.

    Quote Originally Posted by GGG View Post
    haha! You know I worry about everything. What exactly would the page say?
    Besides, what do you care, you will never install it on your site anyway.
    Last edited by Marc_NY; 09-27-2014 at 04:08 PM.

  7. #7
    lol! Precisely what I needed to know.

    The perfect answer for somebody who looks at code without the first clue as to how it actually works.

    Thanks, Marc <3

    EDIT POST: Is that a dare?

  8. #8
    If the user is logged in the newest version of the code now includes user info (Customer ID, Full name, e-mail address, Cart ID).

    The customers id is a link to the customers account info in your admin
    The email address can be clicked on to instantly write an e-mail to them.
    The cart id # is still a link as described before.

    If enough interest exists I will consider adding the cart contents to the e-mail but that is a bit more work.

    Code:
    9/28/2014 10:18:23 AM
    9215 | Joe Smith | joesmith@websiteurl.com
    45B7866FB2F648FE93020AF0527960CC
    
    Please fill in the Billing Address field First Name.
    Please fill in the Billing Address field Last Name.
    Please fill in the Billing Address field Address.
    Please fill in the Billing Address field City.
    Save this as onepageactivity.asp into the root directory via FTP "/v/onepageactivity.asp"

    Code:
    <%
    Option Explicit
    Dim subject : subject = "One Page Checkout Activity Report"
    Dim email_to : email_to = "abc@website.com"
    Dim email_from : email_from = "abc@website.com"
    Dim time_offset : time_offset = 3
    Dim VSMTPKey : VSMTPKey = "<------------enter your key here-------->"
    
    Dim CartID5 : CartID5 = Request.Cookies("CartID5")
    Dim Errortext_formatted
    Dim i
    
    Dim c_name : c_name = Server.URLEncode(Request.Form("c_name"))
    Dim c_email : c_email = Server.URLEncode(Request.Form("c_email"))
    Dim c_id : c_id = Server.URLEncode(Request.Form("c_id"))
    
    Dim User_info_html : User_info_html = ""
    
    If c_id <> "" then
             User_info_html = User_info_html & Server.URLEncode("<a href='https://") & Request.ServerVariables("SERVER_NAME") & Server.URLEncode("/admin/AdminDetails_Generic.asp?table=Customers&ID=") & c_id & "'>" & c_id & "</a>" & Server.URLEncode(" | ")
    End If
    If  c_name <> "" then
              User_info_html = User_info_html & c_name & Server.URLEncode(" | ")
    End If
    If c_email <> "" then
             User_info_html = User_info_html & Server.URLEncode("<a href='mailto:") & c_email & "'>"  & c_email &  "</a><br>"
    End If
    
    
    if Request.Form("Errortext").Count > 0 then	
    
    		For i = 1 To Request.Form("Errortext").Count 
    			Errortext_formatted = Errortext_formatted & Server.URLEncode(Request.Form("Errortext")(i)) & "<BR>" 
    		Next 
    
    		Dim HTTPRequest1
    		Set HTTPRequest1 = CreateObject("WinHTTP.WinHTTPRequest.5.1")
    		HTTPRequest1.Open "POST", "http://" & Request.ServerVariables("LOCAL_ADDR") & "/vsmtp.asp", False
    		HTTPRequest1.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    		HTTPRequest1.SetRequestHeader "Host", Request.ServerVariables("SERVER_NAME")
    		HTTPRequest1.Send _
    			"VsmtpKey=" & VSMTPKey  &_
    			"&Subject=" & Server.URLEncode(subject) &_
    			"&FromEmailAddress=" & email_from &_
    			"&ToEmailAddress=" & email_to &_
    			"&Body_HTML=" & Server.URLEncode(dateadd("h", time_offset, now())) & "<br>" & User_info_html &_
    						      Server.URLEncode("<a href='https://") & Request.ServerVariables("SERVER_NAME") &_
    						      Server.URLEncode("/admin/admindetails_generic.asp?table=CartIDLog&ID=") &  CartID5 & "'>"  & CartID5 & "</a><br>" & "<br>" &_
    						      Errortext_formatted
    		response.write(HTTPRequest1.ResponseText)
    End If
    
    %>
    Then place the following in one of your one-page-checkout articles. Like 115 or 116

    Code:
    <script type="text/javascript">
    function send_c_data(c_data_combined) {
    	jQuery.ajax({
    		url: '/v/onepageactivity.asp',
    		type: 'POST',
    		cache: false,
    		data: c_data_combined,
    		success: function (data) {
    		}
    	});
    }
    
    jQuery(function () {
    	if ( jQuery('.v65-error-list-text').length ) {
    		jQuery.ajax({
    			url: '/api/v1/users/current',
    			type: 'GET',
    			cache: false,
    			dataType: 'json',
    			success: function (data) {
               		var data_string = '';
    					jQuery('.v65-error-list-text ul').find('li').each(function(){
    						data_string = data_string + 'Errortext=' + encodeURIComponent(jQuery.trim(jQuery(this).text())) + '&';
    				});			
    				if (data.data.email) {
    					var data_string_combined = "c_name=" + encodeURIComponent(data.data.firstName + " " + data.data.lastName) + "&c_email=" + encodeURIComponent(data.data.email) + "&c_id=" + data.data.id + "&" + data_string
    					send_c_data(data_string_combined);
    				} else {
    					send_c_data(data_string);
    				}	
    			},
    			error: function () {
    				var data_string = '';
    				jQuery('.v65-error-list-text ul').find('li').each(function(){
    					data_string = data_string + 'Errortext=' + encodeURIComponent(jQuery.trim(jQuery(this).text())) + '&';
    				});
    				send_c_data(data_string);
    			}
    		});
    	}	
    });	
    </script>
    Last edited by Marc_NY; 09-29-2014 at 03:43 AM.

  9. #9
    Marc- this is so cool! Thank you! Trying it out now

  10. #10
    Melanie, It seems that you have it setup and working.

    Unrelated to this but I would highly recommend you remove the fax # from the ship to address as it auto-populates with an e-mail address which will cause the submit to fail if the customer doesn't catch it.

  11. #11
    Amazing work! Volusion really should put you on retainer.

    What a great way to see if something is happening.

  12. #12
    How do I remove the fax#?
    (Yes, I have had that issue with customers)

  13. #13
    Melanie,

    http://www.modernherbshop.com/admin/...iendlyName=fax

    Also, I fixed a few errors in the latest code shown above so you may want to reinstall it from the posted code.

    The Cart id was missing from a non-logged in customer.

  14. #14
    Quote Originally Posted by Marc_NY View Post
    "Enable fax number" in not enabled on my system, yet that field still shows up on the checkout page. Although the help text indicate that enabling this allows access to the field... but does not require it. Should I be submitting a ticket about this?

  15. #15
    Submitting a Ticket is free, the only cost to you being your time...

Similar Threads

  1. Replies: 4
    Last Post: 03-19-2014, 11:35 AM
  2. Checkout error
    By OHC in forum Volusion News
    Replies: 8
    Last Post: 05-03-2013, 03:50 PM
  3. Checkout Redirect Error
    By begolf25 in forum Site Performance
    Replies: 251
    Last Post: 02-12-2013, 03:42 AM
  4. Replies: 3
    Last Post: 12-21-2012, 12:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •