Exit Marketing
The SOLO Server cart can easily be set up to perform exit marketing when a customer abandons the shopping/checkout process before completing an order. This is done through a combination of scripts added to the virtual storefront html along with the Exit Handler Script property of the cart options.
This feature is currently not supported by the .NET cart.
Technical Overview
The exit handling is handled entirely by client side script by the web browser, and is achieved by catching the beforeunload browser event in client script. This event will fire for any navigation event, both off site as well as within the normal shopping/checkout process, so the event handler must determine if the navigation event is a proper click through within the site or navigation offsite. This is accomplished by using a boolean flag variable named properClickThrough which is set to false by default and set to true by any valid onsite navigation event. The event handler then checks if the value is false when handling the before unload event and only executes the exit marketing code if this is the case.
Basic Implementation
While SOLO Server is very flexible in the way things can be set up, in a majority of cases implementation can simply be plugged in as follows:
- Add code to set up the properClickThrough flag variable in the virtual storefront top html. The following code can simply be copy/pasted into the <head> section:
- HTML
- <script type="text/javascript">
//Flag variable for proper click through
//When false, exit handling code will run as the user is navigating offsite
//Default to false – valid navigation events will set it true
var properClickThrough = false;
//If the current page is the thank you page, set properClickThrough to true since the sale has completed
if (document.location.pathname.indexOf("b1_singleform1thankyou.asp") != -1)
{properClickThrough = true;}
</script>
- Update all links in the virtual storefront html to set the properClickThrough flag to true when clicked by adding the following attribute: onclick="properClickThrough=true;"
- Update the cart options and set the Exit Handler Script field to the following: properClickThrough = true;
Integrating the Marketing Specific Code
The marketing specific code will be unique to each implementation, but should follow these rules:
- Code should be placed in a function which is then associated with the window.onbeforeunload event.
- The function should first check if properClickThrough == true, and if so, exit immediately.
Once this code is ready it can be added to a script block in the virtual storefront html. Before doing this, be sure to read the next section on testing.
Testing
In order to test things in production without exposing them to customers, follow these steps:
- Update the default for properClickThrough to true in the virtual storefront html to prevent the code from running by default.
- Add in the marketing specific code to the virtual storefront html.
- Open a new browser window and add an item to the cart. Verify no client side errors occur with the marketing code and fix if necessary.
- Once the marketing code is verified to not cause errors, enter the following in the address bar and hit enter to manually force the marketing code to execute: javascript:properClickThrough=false;document.location='';
- Verify and perform and debugging/fixes required to the marketing code.
Once everything is verified to be working properly, go back and set the default for properClickThrough to false to enable the functionality for all customers.